diff --git a/.agents/discipline.md b/.agents/discipline.md index 151d0b0..6bf202e 100644 --- a/.agents/discipline.md +++ b/.agents/discipline.md @@ -1,7 +1,7 @@ # Discipline — the ambient core These rules apply to **every** conversation in this repo, with or without a -task artifact. A one-shot fix runs under the same discipline as a sliced +task artifact. A quick fix runs under the same discipline as a sliced feature; the only difference is the paperwork. 1. **Read before acting.** At session start, read the reading list declared in @@ -9,7 +9,7 @@ feature; the only difference is the paperwork. most recent journal entries). Say which documents and rules you are working under. -2. **Plan first.** Even for a one-shot fix: say what you are about to do +2. **Plan first.** Even for a quick fix: say what you are about to do before doing it. Nothing half-decided crosses into code. When the work has a spec document, the program design is PERSISTED into its matching work document and approved by the Architect before any code — the "Plan" and @@ -17,21 +17,22 @@ feature; the only difference is the paperwork. 3. **🧑 zones are law.** Sections marked 🧑 in a spec document carry the decisions of whoever approved them — the human, unless the Architect - approved a spec that carried no new decision ("Zone ownership" in - `.agents/reference.md`). Never contradict one silently: if the work - reveals a conflict with a 🧑 zone, stop and surface it. + approved a spec that carried no new decision, or one of a task in one + shot ("Zone ownership" in `.agents/reference.md`). Never contradict one + silently: if the work reveals a conflict with a 🧑 zone, stop and + surface it. 4. **Verify before "done".** Run the project's gate commands declared in `.agents/project.md` §F (lint, tests, build; a browser check when UI behaviour changed). Evidence first — red output is reported as red, never narrated as green. -5. **The bridge rule.** No task artifact for casual conversation or one-shot - work. But when a conversation turns into real, scoped, multi-step work, - recognize it and PROPOSE a task under `.agents/workflow.md` — inform, - never force. Formality is opt-in; detection is not. Most work should stay - small: if everything becomes a big feature, review gets diluted and the - method has failed. +5. **The bridge rule.** No task artifact for casual conversation or a + quick fix. But when a conversation turns into real, scoped, multi-step + work, recognize it and PROPOSE a task under `.agents/workflow.md` — + inform, never force. Formality is opt-in; detection is not. Most work + should stay small: if everything becomes a big feature, review gets + diluted and the method has failed. 6. **Escalate, don't improvise.** Blocked twice on the same thing, or pushed outside the approved plan → stop and report to whoever launched you. The @@ -88,7 +89,7 @@ Not everything starts as a feature idea: | Something's broken (hard bug, flake, regression) | `diagnosing-bugs` — build a repeatable failing check first, THEN theorize; regression test before the fix | the fix lands as normal work | | A design question that talking cannot settle | `prototype` — throwaway code, one command to run; keep the answer, and keep the code on a throwaway branch out of main with a pointer to that branch | back into the spec | | Reading legwork (docs, API facts) | `research` — background agent, cited markdown file | feeds the spec | -| So big and foggy it cannot even be sliced | `wayfinder` — map the open DECISIONS first, resolve them one by one | then the spec document and its slices | +| So big and foggy it cannot even be sliced, or a spec interview that tangles | `wayfinder` — map the open DECISIONS first, resolve them one by one | then the spec document and its slices | | A spare moment to make the codebase nicer to work in | `improve-codebase-architecture` | produces an idea → normal flow | | A whole repo to judge, rather than one change | `codebase-audit` — blind finders one per lens, every claim reproduced, findings triaged against what was already decided | decisions and an action plan; each piece becomes a task by the normal path | diff --git a/.agents/methodology.md b/.agents/methodology.md index e847c17..a378384 100644 --- a/.agents/methodology.md +++ b/.agents/methodology.md @@ -71,8 +71,8 @@ the answer demands them. folder with one slice that duplicates the spec document. - What slicing adds is **decomposition**: blocking edges, the frontier, the order. That only has value when there are several pieces. -- Real-world distribution (dex): ~40% of work is one-shot, medium work gets a - single spec/work pair, only large work gets the full breakdown. +- Real-world distribution (dex): ~40% of work is a quick fix, medium work + gets a single spec/work pair, only large work gets the full breakdown. What IS unconditional: the check itself, stated out loud — "this fits in one pass" or "this needs slicing, here is the breakdown". And **vertical-slice diff --git a/.agents/project.md b/.agents/project.md index dc81944..14a486d 100644 --- a/.agents/project.md +++ b/.agents/project.md @@ -1,6 +1,6 @@ # Project glue - - **Before publishing:** the `chisel-release` skill on the open Release PR (`deno task promote-intentions `, then the gates of Section F). It never tags, merges or publishes. + +## J · Review + + + +- **Default depth:** full +- **E2E command:** _(none — example: `npm run test:e2e`)_ +- **Recording command:** _(none — example: `npx playwright test --video on`)_ +- **Screenshot command:** _(none — example: `node .agents/skills/visual-proof/scripts/captures.ts`)_ +- **Proofs folder:** beside the spec, named by replacing `.spec.md` with `.proofs/` diff --git a/.agents/reference.md b/.agents/reference.md index c95127f..ea550ec 100644 --- a/.agents/reference.md +++ b/.agents/reference.md @@ -20,7 +20,8 @@ for every session are `.agents/discipline.md`. | **Status** | The task's single state, one of the seven values of "Statuses" in `.agents/workflow.md`. | | **Frontier** | The set of slices whose blockers are all done — what can be worked on right now; a task on it has the status `ready`. | | **Expand–contract** | The sequencing for wide mechanical refactors (rename a column, retype a shared symbol): add the new form beside the old → migrate call sites in batches → delete the old form. The exception to vertical slicing. | -| **One-shot** | Work done without a task artifact. The discipline still applies; only the file bookkeeping is skipped. | +| **Quick fix** | Work done without a task artifact. The discipline still applies; only the file bookkeeping is skipped. | +| **One shot** | The lane where a task's only possible human stop is the final review, and that one only when its spec's `**One shot:**` line keeps it ("The one shot" in `.agents/workflow.md`). The other lane is the full lane. | The roles — Architect, Mason, Typist, reviewers — are defined in "The roles" of `.agents/workflow.md`. @@ -36,9 +37,11 @@ decision tickets and resolves them one at a time). A 🧑 zone belongs to whoever **approved** it. The human approves a spec that carries decisions the task did not state; the Architect approves one written from a clear task, and then the zones carry the task's own decisions, which -are the human's. The work document has no zone: it belongs to the Mason -that wrote it. A 🧑 zone is never overridden silently — a conflict with one -is surfaced, never edited sideways. +are the human's. In one shot the Architect approves the spec even when it +carries decisions of its own, and those decisions are then its own. The +work document has no zone: it belongs to the Mason that wrote it. A 🧑 zone +is never overridden silently — a conflict with one is surfaced, never +edited sideways. ## Model tiers diff --git a/.agents/skills/chisel-setup/SKILL.md b/.agents/skills/chisel-setup/SKILL.md index 43290bf..0ecdc90 100644 --- a/.agents/skills/chisel-setup/SKILL.md +++ b/.agents/skills/chisel-setup/SKILL.md @@ -8,7 +8,7 @@ disable-model-invocation: true Turn `.agents/project.md`'s defaults into this repo's actual glue, pose the current dev's personal file, and leave `AGENTS.md` speaking with one voice. -One pass, sections A through I, each confirmed before the next. Re-running +One pass, sections A through J, each confirmed before the next. Re-running later to revisit a single section is normal — treat the current file as the starting recommendation, not as done-forever. On a repo that already had a method of its own, a first `init` stages instead of installing, and this skill @@ -73,18 +73,19 @@ established is *stated* to the user, not asked. Only genuine decisions — things the scan cannot determine on its own, or choices with real alternatives — get a question. -## Step 2 — Walk sections A through I, one at a time +## Step 2 — Walk sections A through J, one at a time For each section, in letter order: 1. State any relevant facts from Step 1's scan. 2. Give your **recommended** value — prefilled from the scan plus the questionnaire defaults (root `/project-management/`; the task files as - the tracker; boilerplate reading list into - `apps/documentation`; living docs = `apps/documentation` for - boilerplate else `doc/**`; gate commands from `package.json`; glossary/ADRs - into `apps/documentation` for boilerplate else root `CONTEXT.md` + - `docs/adr/`; model tiers unset; merge and publish left to the human). + the tracker; boilerplate reading list into `apps/documentation`; living + docs = `apps/documentation` for boilerplate else `doc/**`; gate commands + from `package.json`; glossary/ADRs into `apps/documentation` for + boilerplate else root `CONTEXT.md` + `docs/adr/`; model tiers unset; + merge and publish left to the human; review depth `full`; proof commands + as §J's second question recommends). 3. Wait for the user's answer before moving to the next section. Accepting a recommendation in one word ("yes", "ok", "sounds good") is enough to move on — do not demand elaboration when the user is happy with the default. @@ -169,6 +170,48 @@ Write the answer on §I's two lines: *ask the human* for what stays with the human, *the agent, once the review is clean and the gates pass* for what is handed over. +### §J — ask this, verbatim + +> **When you review a pull request, how far down do you read?** +> +> 1. **Full** — the synthesis, the proofs, then the whole diff through the +> reading guide. +> 2. **Strategic** — the synthesis and the proofs; the diff only where +> something calls you further. +> +> A task can set its own depth on its spec's `**Review depth:**` line. +> +> Recommended: **1 — full**. + +Write `full` or `strategic` on §J's *Default depth* line. Then ask §J's +second question, below. + +### §J — then ask this, verbatim + +> **Which commands prove a screen in this project? Each one is optional.** +> +> 1. **E2E**: the command that runs the end-to-end tests (example: +> `npm run test:e2e`). +> 2. **Recording**: the command that runs them and keeps a video +> (example: `npx playwright test --video on`). +> 3. **Screenshots**: the command that captures pages and compares them +> before → after (chisel ships one: +> `node .agents/skills/visual-proof/scripts/captures.ts`). +> +> Answer « none » for any the project lacks: its tasks then carry no proof +> of that kind, and the review says so. +> +> Recommended, each on its own: +> +> - e2e: the command found in `package.json`, else none; +> - recording: the command found in `package.json`, else none; +> - screenshots: chisel's capture command when Playwright is among the +> project's dependencies, else none. + +Write each answer on its §J line: *E2E command*, *Recording command*, +*Screenshot command*. Keep the reference's *Proofs folder* unless the human +names another folder. + ## Step 3 — §E is read-back only, never asked Section E (Adapters) is written by `chisel init`, not by this questionnaire. @@ -186,8 +229,8 @@ until the end of the walk. Each write is scoped to exactly one section: - Replace everything from immediately after that heading line up to (but not including) the next `## ` heading, or end of file if there is none. - Leave every byte outside that span untouched: other sections, any content - a human added above §A or after §I, custom sections the file doesn't - define (e.g. a hand-added `## I · ...`). + a human added above §A or after §J, custom sections the file doesn't + define (e.g. a hand-added `## K · ...`). **Never rewrite the whole file.** A full-file rewrite is the one mistake that would silently discard user edits living outside the questionnaire's @@ -267,7 +310,7 @@ that page first, then follow it command by command, watching each output. This step stands alone. "Reconcile my `AGENTS.md`" runs THIS step and nothing else — no questionnaire, no sections, no network. In the walk it comes after -§I is written and before the summary. +§J is written and before the summary. A repo that had an `AGENTS.md` before chisel now has two voices in one file: the text it already carried, often describing its own way of working, and the @@ -379,8 +422,8 @@ project's own — and the step reports that and changes nothing. ## Step 8 — Closing summary -After §I is written, print a one-screen summary of what got written: one -line per section, A–I; one line for the personal file; one line for +After §J is written, print a one-screen summary of what got written: one +line per section, A–J; one line for the personal file; one line for `AGENTS.md`, saying what was deleted, what moved to the reading list and what stayed, or that the file already spoke with one voice; and, when §B named a tracker still to set up, the one thing still to do. Then suggest the natural next move: diff --git a/.agents/skills/retro/SKILL.md b/.agents/skills/retro/SKILL.md index d88d18a..f94cdfe 100644 --- a/.agents/skills/retro/SKILL.md +++ b/.agents/skills/retro/SKILL.md @@ -5,7 +5,7 @@ x-upstream: repo: mattpocock/skills path: skills/in-progress/retro sha: 6654f6b60cd9d5be8b54c6fafe44346dabeb3b76 - changes: "adapted: sources are the session transcript AND those of its subagents first, then the repo artifacts that corroborate them (the task's spec document, and its work document with the program design, the checkboxes and the worklog, plus the diff and the journal entry) — reading is unrestricted, only the WRITING of conclusions is bound to the repo by discipline.md rule 8; calls writing-great-skills, which is this same upstream skill vendored under its former name; target files resolve via .agents/project.md instead of hardcoded paths; each proposal names its target file and zone owner; nothing is ever auto-applied, and a deferred proposal gets a dated line instead of being dropped; drops disable-model-invocation — this skill is invoked by the close step of the workflow, not only on user request; a blocker is read where the task's own documents keep it rather than in the project journal." + changes: "adapted: sources are the session transcript AND those of its subagents first, then the repo artifacts that corroborate them (the task's spec document, and its work document with the program design, the checkboxes and the worklog, plus the diff and the journal entry) — reading is unrestricted, only the WRITING of conclusions is bound to the repo by discipline.md rule 8; calls writing-great-skills, which is this same upstream skill vendored under its former name; target files resolve via .agents/project.md instead of hardcoded paths; each proposal names its target file and zone owner; nothing is ever auto-applied, and a deferred proposal gets a dated line instead of being dropped; drops disable-model-invocation — this skill is invoked by the close step of the workflow, not only on user request; a blocker is read where the task's own documents keep it rather than in the project journal; compares the depth each task chose with the floor its diff computed, from the work documents' Depth lines." --- You are suggesting improvements to the **working rules** — the steering @@ -39,7 +39,8 @@ discussed: before a work document existed. - Its **work document** — the program design, the implementation checkboxes, the worklog, Notes & Snippets and the review findings, including - whatever was noted without stopping along the way. + whatever was noted without stopping along the way, and its `**Depth:**` + line. - The diff and commit messages of the session (`git log`, `git diff`). - The dated journal entry the work produced. - Any blocker, and the ruling on it, where the task keeps it: an @@ -82,6 +83,12 @@ discussed: - **Information access**: opportunities to increase access to information — tee'd logs, read-only access to a third-party service. _Use when_ a crucial piece of information was not available. +- **Depth against floor**: compare the depth chosen with the floor the diff + computed, on the `**Depth:**` line of this task's work document and of the + recently archived ones. A candidate is a task above the floor with no + reason given, or a run of tasks above it: either the floor is too low, or + the Architect asks for more than the work needs. _Use when_ the depth + chosen and the floor differ. 4. For each candidate, resolve its **target file** via `.agents/project.md` (the reading list of §C · Reading list, the living docs of diff --git a/.agents/skills/visual-proof/SKILL.md b/.agents/skills/visual-proof/SKILL.md new file mode 100644 index 0000000..69f2b04 --- /dev/null +++ b/.agents/skills/visual-proof/SKILL.md @@ -0,0 +1,133 @@ +--- +name: visual-proof +description: Prove a change to a screen with captures compared by a command, while a fresh sub-agent does any looking. Use when a task touches a screen (a page, a component, a stylesheet, a template, a displayed string, an image), at its plan, code and close steps, or when you are about to take or look at a screenshot. +--- + +# Visual proof + +A capture read in your own thread stays in its context and is read again at +every later call: one session read 22 captures, about 10 MB, for about ten +dollars. So the proof runs **mechanical first**: a command captures and +compares, and you read its text report. A fresh sub-agent does any looking, +and the human sees the images. + +## The project's commands + +§J · Review of `.agents/project.md` names them: + +- **E2E command**: runs the end-to-end tests. +- **Recording command**: runs them and keeps a video. +- **Screenshot command**: captures pages and compares them before → after. + It is usually the command this skill ships, + `node .agents/skills/visual-proof/scripts/captures.ts`. +- **Proofs folder**: where the proof files go, committed with the work. + +Use only the commands §J names. A line left at _(none …)_ means the task has +no proof of that kind, and the review says so. The app runs as the Browser +check line of §F · Gate commands says. + +## Which proofs: the depth line and the floor + +1. **Read the depth line.** The spec's `**Review depth:**` line is `full` + or `strategic`, then each proof the Architect asks for after a `+`: + `captures`, `recording`, `e2e` (for example `strategic + captures`). + With no such line, the depth is §J's default and asks for no proof. +2. **Compute the floor from the diff**: the plan at the plan step, the real + diff at the close. The diff touches a screen when it changes what a user + sees: a page, a component, a stylesheet, a template, a displayed string, + an image or a font. Judge it from the diff; path patterns miss cases. A + screen touched makes the floor `captures`; otherwise the floor is none. +3. **List the proofs**: the line's plus the floor's, so a screen touched + gets captures even when the line left them out. Capture only the screens + the diff touches, each with its path and only the widths it needs + (`--largeurs`): every committed image weighs in the repo's history. + Done when every screen touched has its widths and every proof asked has + a line. +4. **Empty list: stop.** No floor and no proof asked means no capture and + no browser. Write it in the depth record. + +## When: before, during, after + +- **Plan step.** The plan carries the list of step 3. +- **Before the first code change.** Capture, from the base, each listed + screen that already exists: + ` --out /before`. + A new screen has no before. +- **Once the work is typed.** Check the screen yourself: run the E2E + command, through the Recording command when the depth asks for a + recording. With no e2e, check at least the capture command's report. This + check is for you; it joins the proofs only when the depth line asks for + `e2e` or `recording`. +- **At the close.** Capture the after, compared with the before: + ` --out /after --avant /before`. + Done when every listed screen has its after capture and its verdict. + +## Mechanical first + +The capture command writes the captures to disk and prints a text report, +in French. Its options: + +- `--largeurs` sets the widths, 390 and 1280 by default; +- `--avant ` compares each capture, at the pixel, with the one of + the same name in that folder; +- `--clic `, repeated, clicks before the capture, to open a + menu, a tab or an accordion; +- `--sombre` captures the dark colour scheme; +- `--plein` grows the window until a scrolling container shows everything; +- `--json` prints the same facts as JSON. + +With `--avant`, each screen gets a verdict: + +- `identique`: nothing changed; +- a share of pixels changed, with the zone and a `.diff.png` map; +- `pas de capture avant`: a new screen; +- `la taille change`: the size changed. + +The report also gives an overflow at each width (`DÉBORDE`), console +errors, requests that leave the site, and content hidden below the fold of +a scrolling container (`SOUS LE PLI`: run again with `--plein`). + +Often the text settles it. `identique` where nothing should change is +verified. An overflow at 390 px is a bug: fix it before anyone looks. + +The command runs from the project's root and needs: + +- Node 24.2 or later. On an older Node it silently does nothing. +- Playwright in the project's `node_modules` (`playwright`, + `playwright-core` or `@playwright/test`) and a Chromium it installed, or + a remote Playwright server named by `CHISEL_PLAYWRIGHT_WS`. + +The script is TypeScript for Node, outside the project's own build. A +project whose linter or type checker reaches `.agents/` excludes the +script, `.agents/skills/visual-proof/scripts/captures.ts`. + +## Looking: a fresh sub-agent + +When the text does not settle it, a fresh sub-agent on the mid tier of +`.agents/reference.md` looks, and you read its report. Hand it: + +- the paths of the captures, the `.diff.png` maps and the text report; +- the precise question, and the list of what it must find on each capture; +- the rule that what it cannot see is « not verified », never « absent »; +- the report's form: for each capture, compliant or not, and where each + defect sits; no general description; +- the order to change nothing. + +Never open a capture with your own Read tool, not even one: the paths go +to a fresh sub-agent, since one capture read stays in your context for +every later call. Launch a new sub-agent for each round, since one that saw +the old version sees what it expects. + +## The proofs at the review + +The proof files stay in the proofs folder. The pull request's description +links each one: for a changed screen, the before and the after side by +side, with the `.diff.png`. You write the paths unseen; the human looks. A +proof the depth asks for that the project has no command for is named +there as missing. + +## The depth record + +At the close, write the work document's `**Depth:**` line: the depth +chosen, the floor the diff computed and, above the floor, what the task +added and why. `retro` compares the two. diff --git a/.agents/skills/visual-proof/scripts/captures.ts b/.agents/skills/visual-proof/scripts/captures.ts new file mode 100644 index 0000000..92da044 --- /dev/null +++ b/.agents/skills/visual-proof/scripts/captures.ts @@ -0,0 +1,242 @@ +#!/usr/bin/env node +// SPDX-License-Identifier: MIT +// Copied into Chisel from the Harness (vault commit a05b1092), with Olympe's +// agreement of 21/11/2026, under Chisel's licence. A copy, not a link. +// captures : prendre les captures d'une page et dire, en texte, ce qui a changé. +// +// Pourquoi : une capture lue par l'outil Read reste dans le contexte de la session et se relit +// à chaque appel. Une session qui a lu 22 PNG (~10 Mo) a coûté près de 10 $. +// Ce script fait le travail mécanique sans modèle : +// les captures vont sur le disque, la comparaison avant/après se fait au pixel, et seul un +// rapport en texte revient. Regarder une image reste le travail d'un sous-agent +// (skill visual-proof), jamais du fil principal. +// +// Usage : +// node captures.ts --out [--largeurs 390,1280] [--avant ] [--plein] [--sombre] [--clic ]... [--json] +// --sombre : la page avec prefers-color-scheme: dark. --clic : clique cet élément avant la capture ; répétée, +// elle enchaîne les clics dans l'ordre (un menu ouvert, un onglet, un accordéon). Un sélecteur sans élément fait échouer la commande. +// Une page qui défile dans un conteneur interne se capture à la hauteur de la fenêtre : ce qui est +// sous le pli manque, et un sous-agent l'a déjà dit absent. Le rapport le signale ; --plein agrandit la fenêtre +// jusqu'à ce que le conteneur montre tout. +// Un conteneur qui défile de côté est signalé, avec ce qu'il cache. +// Playwright vient du repo où l'on se trouve (node_modules : playwright, playwright-core ou +// @playwright/test), sinon d'un playwright-core posé à côté de ce script. +// Si CHISEL_PLAYWRIGHT_WS est définie, le navigateur est celui du serveur Playwright qu'elle désigne : +// chromium.connect avec exposeNetwork '', qui lui montre le localhost de ce client. + +import { createRequire } from 'node:module'; +import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { homedir } from 'node:os'; +import { join } from 'node:path'; + +// cache : les px qui restent cachés dans un conteneur qui défile en hauteur ; cote : les conteneurs qui défilent de côté. +export type Shot = { chemin: string; largeur: number; fichier: string; hauteur: number; debord: number; erreurs: string[]; titre: string; cache?: number; cote?: string[]; clics?: string[] }; +export type Diff = { fichier: string; statut: 'identique' | 'change' | 'nouveau' | 'taille'; pixels?: number; part?: number; zone?: { x: number; y: number; l: number; h: number }; image?: string; avant?: [number, number]; apres?: [number, number] }; + +export function nomFichier(chemin: string, largeur: number): string { + const base = chemin === '/' || chemin === '' ? 'accueil' : chemin.replace(/[^a-zA-Z0-9-]+/g, '_').replace(/^_+|_+$/g, ''); + return `${base || 'page'}-${largeur}.png`; +} + +export function parseArgs(argv: string[]) { + const pos: string[] = []; + const o: { out?: string; largeurs: number[]; avant?: string; json: boolean; plein: boolean; sombre: boolean; clics: string[] } = { largeurs: [390, 1280], json: false, plein: false, sombre: false, clics: [] }; + for (let i = 0; i < argv.length; i++) { + const a = argv[i]; + if (a === '--out') o.out = argv[++i]; + else if (a === '--avant') o.avant = argv[++i]; + else if (a === '--largeurs') o.largeurs = argv[++i].split(',').map(Number); + else if (a === '--json') o.json = true; + else if (a === '--plein') o.plein = true; + else if (a === '--sombre') o.sombre = true; // prefers-color-scheme: dark ; sans, Chromium se dit en clair + else if (a === '--clic') { const sel = argv[++i]; if (!sel || sel.startsWith('--')) throw new Error('--clic : un sélecteur CSS est attendu'); o.clics.push(sel); } + else if (a.startsWith('-')) throw new Error(`option inconnue : ${a}\nusage : node captures.ts --out [--largeurs 390,1280] [--avant ] [--plein] [--sombre] [--clic ]... [--json]`); + else pos.push(a); + } + if (pos.length < 2 || !o.out) throw new Error('usage : node captures.ts --out [--largeurs 390,1280] [--avant ] [--plein] [--sombre] [--clic ]... [--json]'); + if (o.largeurs.some((n) => !Number.isInteger(n) || n < 200 || n > 4000)) throw new Error('--largeurs : des entiers entre 200 et 4000'); + return { base: pos[0].replace(/\/$/, ''), chemins: pos[1].split(',').map((c) => (c.startsWith('/') ? c : '/' + c)), ...o }; +} + +function chargerPlaywright(): any { + const essais = [process.cwd()]; + for (const dir of essais) { + const req = createRequire(join(dir, 'package.json')); + for (const nom of ['playwright', 'playwright-core', '@playwright/test']) { + try { return req(nom); } catch { /* suivant */ } + } + } + try { return createRequire(import.meta.url)('playwright-core'); } catch { /* introuvable */ } + throw new Error('Playwright introuvable : lance la commande depuis un repo qui l’a dans node_modules'); +} + +function chromeEnCache(): string | undefined { + const cache = join(homedir(), process.platform === 'darwin' ? 'Library/Caches/ms-playwright' : '.cache/ms-playwright'); + if (!existsSync(cache)) return undefined; + const dirs = readdirSync(cache).filter((d) => /^chromium-\d+$/.test(d)).sort((a, b) => Number(b.split('-')[1]) - Number(a.split('-')[1])); + for (const d of dirs) { + for (const exe of ['chrome-linux64/chrome', 'chrome-linux/chrome', 'chrome-mac/Chromium.app/Contents/MacOS/Chromium', 'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing']) { + const p = join(cache, d, exe); + if (existsSync(p)) return p; + } + } + return undefined; +} + +// La voie du navigateur : le serveur Playwright commun si la variable est définie et non vide, sinon un Chromium local. +export function voieNavigateur(env: Record = process.env): { voie: 'distant'; ws: string } | { voie: 'local' } { + const ws = env.CHISEL_PLAYWRIGHT_WS?.trim(); + return ws ? { voie: 'distant', ws } : { voie: 'local' }; +} + +async function lancer(pw: any) { + const voie = voieNavigateur(); + if (voie.voie === 'distant') return await pw.chromium.connect(voie.ws, { exposeNetwork: '' }); + try { return await pw.chromium.launch(); } catch (e) { + const exe = chromeEnCache(); + if (!exe) throw e; + return await pw.chromium.launch({ executablePath: exe }); + } +} + +// Les conteneurs internes qui défilent (html et body exclus, que fullPage capture déjà) : la plus grande hauteur cachée, +// et ceux qui défilent de côté, nommés par balise, id et première classe. +function mesurer(): { cache: number; cote: string[] } { + let cache = 0; + const cote: string[] = []; + for (const e of Array.from(document.querySelectorAll('body *')) as HTMLElement[]) { + const st = getComputedStyle(e); + if (/(auto|scroll)/.test(st.overflowY) && e.scrollHeight > e.clientHeight + 1) cache = Math.max(cache, e.scrollHeight - e.clientHeight); + if (/(auto|scroll)/.test(st.overflowX) && e.scrollWidth > e.clientWidth + 1) { + const nom = e.tagName.toLowerCase() + (e.id ? '#' + e.id : '') + (e.classList[0] ? '.' + e.classList[0] : ''); + cote.push(`${nom} (${e.scrollWidth - e.clientWidth}px cachés)`); + } + } + return { cache, cote }; +} + +// La comparaison se fait dans le navigateur : il décode les PNG, sans dépendance. +async function comparer(page: any, avant: string, apres: string, sortie: string): Promise & { statut: Diff['statut'] }> { + const a = 'data:image/png;base64,' + readFileSync(avant).toString('base64'); + const b = 'data:image/png;base64,' + readFileSync(apres).toString('base64'); + const r = await page.evaluate(async ([a, b]: [string, string]) => { + const charger = (src: string) => new Promise((ok, ko) => { const i = new Image(); i.onload = () => ok(i); i.onerror = ko; i.src = src; }); + const [ia, ib] = await Promise.all([charger(a), charger(b)]); + const taille = ia.width !== ib.width || ia.height !== ib.height; + // Tailles différentes : on compare la zone commune, en haut à gauche. + const w = Math.min(ia.width, ib.width), h = Math.min(ia.height, ib.height); + const ctx = (img: HTMLImageElement) => { const c = document.createElement('canvas'); c.width = w; c.height = h; const x = c.getContext('2d')!; x.drawImage(img, 0, 0); return x.getImageData(0, 0, w, h); }; + const da = ctx(ia).data, db = ctx(ib).data; + const out = document.createElement('canvas'); out.width = w; out.height = h; + const ox = out.getContext('2d')!; const od = ox.createImageData(w, h); + let n = 0, x0 = w, y0 = h, x1 = -1, y1 = -1; + for (let i = 0; i < da.length; i += 4) { + const d = Math.abs(da[i] - db[i]) + Math.abs(da[i + 1] - db[i + 1]) + Math.abs(da[i + 2] - db[i + 2]); + const p = i / 4, x = p % w, y = (p / w) | 0; + if (d > 24) { + n++; if (x < x0) x0 = x; if (y < y0) y0 = y; if (x > x1) x1 = x; if (y > y1) y1 = y; + od.data[i] = 255; od.data[i + 1] = 0; od.data[i + 2] = 80; od.data[i + 3] = 255; + } else { const g = (db[i] + db[i + 1] + db[i + 2]) / 3; od.data[i] = od.data[i + 1] = od.data[i + 2] = 255 - (255 - g) * 0.25; od.data[i + 3] = 255; } + } + ox.putImageData(od, 0, 0); + return { taille, avant: [ia.width, ia.height], apres: [ib.width, ib.height], n, total: w * h, zone: n ? { x: x0, y: y0, l: x1 - x0 + 1, h: y1 - y0 + 1 } : undefined, png: n ? out.toDataURL('image/png') : undefined }; + }, [a, b]); + const tailles = r.taille ? { avant: r.avant, apres: r.apres } : {}; + if (!r.n) return { statut: r.taille ? 'taille' : 'identique', pixels: 0, part: 0, ...tailles }; + writeFileSync(sortie, Buffer.from(r.png.split(',')[1], 'base64')); + return { statut: r.taille ? 'taille' : 'change', ...tailles, pixels: r.n, part: Math.round((r.n / r.total) * 10000) / 100, zone: r.zone, image: sortie }; +} + +export async function capturer(o: ReturnType, pw = chargerPlaywright()) { + mkdirSync(o.out!, { recursive: true }); + const browser = await lancer(pw); + const shots: Shot[] = []; + const externes = new Set(); + const hote = new URL(o.base).hostname; + try { + for (const largeur of o.largeurs) { + const ctx = await browser.newContext({ viewport: { width: largeur, height: 900 }, reducedMotion: 'reduce', colorScheme: o.sombre ? 'dark' : 'light' }); + const page = await ctx.newPage(); + let erreurs: string[] = []; + page.on('pageerror', (e: Error) => erreurs.push(String(e.message).slice(0, 200))); + page.on('console', (m: any) => { if (m.type() === 'error') erreurs.push(String(m.text()).slice(0, 200)); }); + page.on('request', (r: any) => { try { const u = new URL(r.url()); if (/^https?:$/.test(u.protocol) && u.hostname !== hote) externes.add(u.origin); } catch { /* data: */ } }); + for (const chemin of o.chemins) { + erreurs = []; + await page.goto(o.base + chemin, { waitUntil: 'networkidle' }); + // Faire défiler pour déclencher le chargement paresseux, puis revenir en haut. + await page.evaluate(async () => { for (let y = 0; y < document.body.scrollHeight; y += 600) { window.scrollTo(0, y); await new Promise((r) => setTimeout(r, 30)); } window.scrollTo(0, 0); }); + await page.waitForTimeout(300); + // --plein : la fenêtre grandit de ce que cache le conteneur, jusqu'à ce qu'il montre tout (30 000 px au plus). + let haut = 900; + for (let i = 0; o.plein && i < 4; i++) { + const { cache } = await page.evaluate(mesurer); + if (cache <= 0 || haut >= 30_000) break; + haut = Math.min(30_000, haut + cache); + await page.setViewportSize({ width: largeur, height: haut }); + await page.waitForTimeout(300); + } + // --clic : les clics dans l'ordre, chacun suivi d'une courte pause pour que la page réagisse. + for (const sel of o.clics) { + try { await page.locator(sel).first().click({ timeout: 5000 }); } catch (e: any) { throw new Error(`--clic ${sel} sur ${chemin} à ${largeur}px : ${String(e.message).split('\n')[0]}`); } + await page.waitForTimeout(300); + } + const fichier = join(o.out!, nomFichier(chemin, largeur)); + await page.screenshot({ path: fichier, fullPage: true }); + const vu = await page.evaluate(mesurer); + if (haut !== 900) await page.setViewportSize({ width: largeur, height: 900 }); + const m = await page.evaluate(() => ({ debord: document.documentElement.scrollWidth - window.innerWidth, hauteur: document.documentElement.scrollHeight, titre: document.title })); + shots.push({ chemin, largeur, fichier, hauteur: Math.max(m.hauteur, haut), debord: Math.max(0, m.debord), erreurs: [...erreurs], titre: m.titre, cache: vu.cache, cote: vu.cote, ...(o.clics.length ? { clics: o.clics } : {}) }); + } + await ctx.close(); + } + const diffs: Diff[] = []; + if (o.avant) { + const page = await (await browser.newContext()).newPage(); + for (const s of shots) { + const nom = nomFichier(s.chemin, s.largeur); + const avant = join(o.avant, nom); + if (!existsSync(avant)) { diffs.push({ fichier: nom, statut: 'nouveau' }); continue; } + diffs.push({ fichier: nom, ...(await comparer(page, avant, s.fichier, join(o.out!, nom.replace(/\.png$/, '.diff.png')))) }); + } + } + return { shots, diffs, externes: [...externes] }; + } finally { + await browser.close(); + } +} + +export function rapport(r: Awaited>, plein = false): string { + const l: string[] = []; + l.push(`${r.shots.length} capture(s) :`); + for (const s of r.shots) { + const marques = [s.clics?.length ? `après clic : ${s.clics.join(' puis ')}` : '', s.debord ? `DÉBORDE de ${s.debord}px` : '', + s.cache ? `SOUS LE PLI : ${s.cache}px cachés dans un conteneur qui défile${plein ? '' : ', relance avec --plein'}` : '', + s.cote?.length ? `défile de côté : ${s.cote.join(', ')}` : '', + s.erreurs.length ? `${s.erreurs.length} erreur(s) : ${s.erreurs.join(' | ')}` : ''].filter(Boolean).join(' · '); + l.push(`- ${s.chemin} à ${s.largeur}px : ${s.fichier} (hauteur ${s.hauteur}px${s.titre ? `, « ${s.titre} »` : ''})${marques ? ' · ' + marques : ''}`); + } + if (r.diffs.length) { + l.push('', 'Avant/après :'); + for (const d of r.diffs) { + if (d.statut === 'identique') l.push(`- ${d.fichier} : identique`); + else if (d.statut === 'nouveau') l.push(`- ${d.fichier} : pas de capture avant`); + else { + const taille = d.statut === 'taille' ? `la taille change, ${d.avant!.join('×')} → ${d.apres!.join('×')} ; sur la zone commune, ` : ''; + l.push(`- ${d.fichier} : ${taille}${d.pixels ? `${d.part} % des pixels changent, dans la zone x ${d.zone!.x}, y ${d.zone!.y}, ${d.zone!.l}×${d.zone!.h} px · carte : ${d.image}` : 'rien ne change'}`); + } + } + } + l.push('', r.externes.length ? `Requêtes hors du site : ${r.externes.join(', ')}` : 'Aucune requête hors du site.'); + if (r.shots.some((s) => s.cache || s.cote?.length)) l.push('Ce qui est sous le pli ou caché de côté n\'est pas sur la capture : pour le sous-agent, « absent » y veut dire « non vérifié ».'); + l.push('Ne lis pas ces images dans ton fil : confie-les à un sous-agent (skill visual-proof).'); + return l.join('\n'); +} + +async function main() { + const o = parseArgs(process.argv.slice(2)); + const r = await capturer(o); + console.log(o.json ? JSON.stringify(r, null, 2) : rapport(r, o.plein)); +} + +if (import.meta.main) main().catch((e) => { console.error(`captures : ${String(e.message).slice(0, 400)}`); process.exit(1); }); diff --git a/.agents/synthesis.md.tpl b/.agents/synthesis.md.tpl new file mode 100644 index 0000000..2f35ef3 --- /dev/null +++ b/.agents/synthesis.md.tpl @@ -0,0 +1,26 @@ +# Synthesis — + + + +## What changed and why + + + +## Critical decisions + + + +## Data schema, before → after + + + +## Architecture change + + diff --git a/.agents/workflow.md b/.agents/workflow.md index d7c169f..59d4052 100644 --- a/.agents/workflow.md +++ b/.agents/workflow.md @@ -19,13 +19,14 @@ or a script. | Role | Who plays it | What it does | |---|---|---| | **Architect** | The agent a human, or an orchestrator, talks to. This is its default role. | Reads the task, writes or sharpens the spec, launches a Mason and talks with it, reads and corrects the plan, rules on what the Mason reports, brings the key questions to the human. | -| **Mason** | A sub-agent launched by the Architect. | Writes the plan in the work document and stops for the Architect's reading. Then launches a Typist to code it, runs `code-review`, and closes the task. | +| **Mason** | A sub-agent launched by the Architect. | Writes the plan in the work document and stops for the Architect's reading. Then launches a Typist to code it, runs `code-review`, and closes the task. Woken again after the close, it fixes the human review's comments. | | **Typist** | A sub-agent launched by the Mason once the plan is approved. | Types code from the approved plan and decides nothing, at a cheaper tier than the Mason's (`.agents/reference.md`, "Model tiers"). | | **Reviewers** | Sub-agents launched by the `code-review` skill. | Read the diff with no context from the session that wrote it. | **The human** owns the intent and the decisions that shape the task. The Architect approves the plan. A plan that departs from a decision the human -made goes back to the human, with the question stated. +made goes back to the human, with the question stated, except in one shot +("The one shot", below). The Architect's thread can be one long thread that compacts and serves as the entry point to a project, or one thread per piece of work. In a long @@ -38,74 +39,189 @@ skill or tool the tracker section of `.agents/project.md` names: an issue in a tracker, a line in beads, a spec document in the task workspace, or simply the message in the prompt. -**2. Write or sharpen the spec — Architect.** When the task arrives clear — -a well-written issue, a clear request — write the spec document from it, -with no interview: from the spec template declared in `.agents/project.md`, -named with the task id script, short, linking the issue rather than copying -it. When the intent is unclear, interview the human first with the -`grilling` skill, one question at a time, a recommended answer with each, -with `domain-modeling` underneath: new domain terms land in the glossary -and hard-to-reverse decisions in an ADR, where the glossary and decisions -section of `.agents/project.md` puts them. Either way the seams are named, and the sizing check is said out loud: the -task fits one pass, or it is cut into slices with the `slice-task` skill. -The human approves the spec when it carries decisions the task did not -state; otherwise the Architect moves it to `ready` itself. Commit the spec. -Status: `draft`, then `ready`. - -**3. Plan — Mason.** The Architect launches a Mason with the brief -below. The Mason reads the spec document and what it links to, creates -the work document beside it from the work template, and persists its -program design there: files, seam signatures, test order, the decisions the -spec left to the implementation. Then it stops and reports. No code before -the plan is approved. Status: `in-progress`, written by the Architect at -launch. +**2. Write or sharpen the spec — Architect.** When the task arrives clear — a +well-written issue, a clear request — write the spec document from it, with no +interview: from the spec template declared in `.agents/project.md`, named with +the task id script, short, linking the issue rather than copying it. When the +intent is unclear, interview the human first with the `grilling` skill, one +question at a time, a recommended answer with each, with `domain-modeling` +underneath: new domain terms land in the glossary and hard-to-reverse decisions +in an ADR, where the glossary and decisions section of `.agents/project.md` puts +them. When the interview tangles — each answer opens more questions than it +settles — switch to the `wayfinder` skill: a map of decision tickets, resolved +one at a time, whose destination is the spec. Either way the seams are named, +and the sizing check is said out loud: the task fits one pass, or it is cut into +slices with the `slice-task` skill. The spec carries a `**Review depth:**` line +when the task departs from the default of §J · Review of `.agents/project.md`. +The line gives `full` or `strategic`, then each proof the Architect asks for +after a `+` (`captures`, `recording`, `e2e`), as in `strategic + captures`. The +spec also carries a `**One shot:**` line when the Architect takes the one shot +("The one shot", below). The human approves the spec when it carries decisions +the task did not state, unless the task runs in one shot. In every other case +the Architect moves it to `ready` itself. Commit the spec. Status: `draft`, then +`ready`. + +**3. Plan — Mason.** The Architect launches a Mason with the brief below. The +Mason reads the spec document and what it links to, creates the work document +beside it from the work template, and persists its program design there: files, +seam signatures, test order, the decisions the spec left to the implementation, +and, when the task touches a screen, the screens and the proofs the +`visual-proof` skill asks for. Then it stops and reports. No code before the +plan is approved. Status: `in-progress`, written by the Architect at launch. **4. Read the plan — Architect.** Read the spec and the work document, nothing else. Correct the plan with the Mason, then approve it: the approval is written on the work document's `**Plan:**` line, with who and -when. A plan that departs from a decision the human made goes to the human -first. - -**5. Code — a Typist the Mason launches.** Once the plan is approved, -the Mason launches a Typist with the brief below. The Mason types -itself only a retouch of a few lines, or while the plan is not settled, and -writes which exception applies and why in the work document's worklog. The -Typist executes the approved plan in vertical steps, test-first at the -agreed seams (the `tdd` skill). Tick -the work document's checkboxes as work lands — they are the resume point — -and commit at each green step. Run the gate commands declared in -`.agents/project.md`. Reality that contradicts the plan is fixed in the -plan, in writing; reality that contradicts the spec is reported. +when, and the id the Mason's harness resumes it by. A plan that departs +from a decision the human made goes to the human first, except in one +shot. + +**5. Code — a Typist the Mason launches.** Once the plan is approved, the Mason +launches a Typist with the brief below. The Mason types itself only a retouch of +a few lines, or while the plan is not settled, and writes which exception +applies and why in the work document's worklog. The Typist executes the approved +plan in vertical steps, test-first at the agreed seams (the `tdd` skill). When +the task touches a screen, the before captures are taken before the first code +change, and the screen is checked once it is typed, as the `visual-proof` skill +says. Tick the work document's checkboxes as work lands — they are the resume +point — and commit at each green step. Run the gate commands declared in +`.agents/project.md`. Reality that contradicts the plan is fixed in the plan, in +writing; reality that contradicts the spec is reported. **6. Review — Mason.** Run the `code-review` skill on the full diff of the task. Its reviewers are fresh sub-agents that never saw the session that wrote the code — never skip this step, even for a small retouch. Write the findings in the work document; fix each one or answer it there. -**7. Close — Mason.** Tick the spec's acceptance criteria against -reality. Promote evergreen material into the living docs declared in -`.agents/project.md`, the glossary and the ADRs among them. Archive the spec and work documents together. Add the -dated journal entry. Run the `retro` skill and put its proposals in the -report. Stop everything you started — Docker containers, dev servers, -background processes — each by its own identifier (container name or id, -PID), and only those: never by pattern (`pkill -f`, `--all`), which stops -the work of others. Commit, update the tracker, and report to the -Architect: what landed, which criteria are met, what is left. Status: -`done`. +**7. Close — Mason.** Tick the spec's acceptance criteria against reality. When +the task touches a screen, take the after captures into the proofs folder of §J +· Review. Write the work document's `**Depth:**` line: the depth chosen, the +floor the diff computed with the `visual-proof` skill, and why the task went +above the floor when it did. Promote evergreen material into the living docs +declared in `.agents/project.md`, the glossary and the ADRs among them. Write +the synthesis from `.agents/synthesis.md.tpl`, beside the spec and named by +replacing `.spec.md` with `.synthesis.md`: it is the first reading of the human +review (step 8), so write it on the frontier tier. Archive the spec, work and +synthesis documents together. Add the dated journal entry. Run the `retro` skill +and put its proposals in the report. Stop everything you started — Docker +containers, dev servers, background processes — each by its own identifier +(container name or id, PID), and only those: never by pattern (`pkill -f`, +`--all`), which stops the work of others. This does not end the Mason itself: +its session is kept, so that the Architect can wake it at step 8, Human review, +to fix the comments. Commit, update the tracker, and report to the Architect: +what landed, which criteria are met, what is left. Status: `done`. **After the close — Architect.** Read the close report and rule on anything -left. Open the pull request. Merge and publish as the merge and publish -section of `.agents/project.md` says; by default, ask the human, whose -explicit word on that very action is the only go. +left. Open the pull request; in one shot, its description opens with the +spec's `**One shot:**` line, copied as is. Run the human review (step 8) on +it, unless that line skips the final review. Once the review is done or +skipped, merge and publish as the merge and publish section of +`.agents/project.md` says; by default, ask the human, whose explicit word +on that very action is the only go. In one shot with the final review, the +Architect says in so many words, as it hands the review, that approving it +is the word for the merge; the approval is then that word. + +**8. Human review — Architect.** The pull request is open and the +synthesis is committed in it. The human reads in three readings, in this +order, and may stop after the first. + +- **Strategic: the synthesis.** One article page at most, never one + sentence, written at step 7: what changed and why, the critical + decisions, the data schema before and after, any large architecture + change. The human may stop there with comments, and the review goes no + further. +- **Proofs: what the depth and the floor demand.** The captures, + recordings and e2e results the spec's depth line asks for, plus the + captures the floor adds when the diff touches a screen. They are read + after the synthesis and before the guide. They are files in the proofs + folder of §J · Review, committed with the work. The pull request's + description links each one, with a before → after pair for each changed + screen. The human looks at them himself. A kind of proof the project has + no command for is named there as missing. +- **Reading guide: the crit story.** The Architect writes it with + `crit story --guide` and the project's guide, on the PR diff. Its first + chapter holds only the synthesis file's hunk, and its prologue says to + read that first and that the review may stop there. The code chapters + come last. + +How far the human goes is the spec's `**Review depth:**` line, or §J · +Review of `.agents/project.md` when the spec has none. `strategic` is the +synthesis plus the proofs; `full` goes down to the reading guide. The diff +stays a floor: `strategic` never skips the proofs, and a screen touched +brings captures whatever the line says. + +The base is read from the pull request, never assumed to be `main`: +`gh pr view --json number,baseRefName`. The story is prepared and +ingested with `--pr --base-branch `, and the wait is +`crit --pr --base-branch `, run in the background. Without a +forge pull request, review the branch diff with `--base-branch `, +where the base is the branch the work was cut from. + +The Architect waits for the human and answers every comment. No question +goes into crit: questions go to the human, in conversation. An expired +wait is not a blocker: re-run the same crit command, or `crit --session +`, and wait again. Only another failure is a blocker. If `crit` is not +installed, say where to get it (https://crit.md, then `crit install +`) and stop for the human. + +**Who fixes the comments.** A comment that asks for a change goes to the +task's Mason, the one that planned, coded and closed it. The Architect +wakes it in its own session, however long ago it closed: waking it costs +as much as a fresh one, but it holds the whole context. A fresh Mason only +when that session is lost; it starts from the spec, work and synthesis +documents, where step 7 archived them. A comment that changes a decision +of the spec: the Architect writes the new decision into the spec first, +then wakes the same Mason on it. The Mason fixes as it fixes a review +finding: through a Typist unless the fix is a retouch of a few lines, the +gate commands, `code-review` on the fix's diff, each comment written in +the work document with its fix or its answer, the synthesis amended when a +critical decision moved. It commits on the pull request's branch and +reports to the Architect, who answers the comment in crit and waits again. +The status stays `done`: the review is of a pull request, not a status. + +The review ends when the human approves, or when every comment is answered +and addressed. Merging then follows "After the close", above. + +## The one shot + +A task can run in **one shot**: the human's only possible stop is the final +review, and the spec says whether it happens. The Architect takes the one +shot at step 2 when it judges the task small, or when the human asks for +it. A human who asks for the full lane always gets it. There is no project +switch: the lane is chosen task by task. + +The Architect writes the choice in one line of the spec, directly under its +`**Status:**` line, or under `**Review depth:**` when the spec has one: + + **One shot:** ; final review kept + +`` is the reason: the task is small, or the human asked for it. The +line ends in `final review skipped` when there is no final review. The +pull request repeats it. + +What the one shot skips: the human's reading of the spec, which the +Architect approves itself even when it carries decisions the task did not +state, and every stop that only serves a human reading after it; "Where the +work stops" says which. What it keeps: the plan and the Architect's reading +of it, the Typist, the code review and its fresh reviewers, the gate +commands, the close and its synthesis, and the pull request. When the line +keeps the final review, it runs as step 8 says, at the spec's depth. A plan +that departs from the human's decisions is the Architect's to rule on: it +writes the ruling on the `**Plan:**` line, and the synthesis names it among +the critical decisions. ## Where the work stops -| Who stops | For whom | When | -|---|---|---| -| Mason | Architect | After the plan; after the close, with its report; on a blocker it cannot rule on | -| Typist | Mason | After its part of the plan; on anything the plan does not answer | -| Architect | Human | On an unclear intent; on a spec that carries decisions the task did not state; on a plan that departs from the human's decisions; on a blocker above what it owns | -| Architect | Human | Before a merge or a publish, unless the project lets the agent do it | +| Who stops | For whom | When | In one shot | +|---|---|---|---| +| Mason | Architect | After the plan; after the close, with its report; after fixing the human review's comments; on a blocker it cannot rule on | Kept; no comments to fix when the final review is skipped | +| Typist | Mason | After its part of the plan; on anything the plan does not answer | Kept | +| Architect | Human | On an unclear intent | Kept: the intent is settled before the lane is chosen | +| Architect | Human | On a spec that carries decisions the task did not state | Removed: the Architect approves the spec | +| Architect | Human | On a plan that departs from the human's decisions | Removed: the Architect rules, and the synthesis says so | +| Architect | Human | On a blocker above what it owns | Kept | +| Architect | Human | At the human review, waiting for the human's reading of the pull request | Only when the spec's `**One shot:**` line keeps the final review | +| Architect | Human | Before a merge or a publish, unless the project lets the agent do it | With the final review, its approval is the word for the merge; without it, kept | Everything else runs without a stop. A question that is not one of these is the Architect's to settle. @@ -151,9 +267,9 @@ write. Three earn it: A brief is artifacts and paths, never the conversation: whatever the sub-agent needs must already be in the repo. Reviewers are always fresh. A -Mason is reused within a live thread — the one that wrote the plan -launches its Typist and runs the review — and a resumed task starts fresh -from the spec and work documents. +Mason is kept for its whole task: the one that wrote the plan launches its +Typist, runs the review, closes, and fixes the human review's comments. +"Who fixes the comments", in step 8, says when a fresh one replaces it. A sub-agent does not inherit the repo's or the runtime's rules, only its brief, so every brief below also carries these: @@ -178,7 +294,8 @@ What the Architect writes when it launches a Mason: - the branch to work on, and how to commit (explicit paths, no push); - the gate commands; - the steps it owns: plan, then stop for the reading; code, through a - Typist; `code-review`; close; + Typist; `code-review`; close; then, when woken, the human review's + comments; - the model tiers, resolved to concrete models (`.agents/reference.md`, "Model tiers"): the Mason's own, which the Architect **names explicitly when it launches the Mason**, and the Typist's, for the Mason to name @@ -186,6 +303,8 @@ What the Architect writes when it launches a Mason: launcher's; - what it reports at each stop: the plan in a few lines and its questions; at the close, the commits, the criteria met or not, and what is left; + after the comments, the commits and how each comment was fixed or + answered; - two reports, so the first must not be lost: the plan report is written in the work document before it is sent. diff --git a/AGENTS.md b/AGENTS.md index a7a798a..0fef40c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -11,8 +11,12 @@ methodology it ships. record (`project-management/review-360-decisions.md`), the doctrine — never in an assistant's private memory: future agents are not necessarily the same assistant (Owner ruling G17, 2026-09-02). Role reuse follows ruling - G16: reviewers fresh, the Mason (named the Crewmate in the record) - reused within a live thread. + G16, widened by the decision "The Mason who did the work fixes the + comments" of the human-review task + (`project-management/tasks/20261119-1644-relecture-humaine.spec.md`, "The + decisions"): reviewers fresh, the Mason (named the Crewmate in the record) + kept for its whole task, the human review's comments included; a fresh + Mason only when its session is lost. - The canonical socle now lives in `socle/` (imported from the music-downloader pilot at slice 01). diff --git a/PHILOSOPHY.md b/PHILOSOPHY.md index ba85e63..33fd0df 100644 --- a/PHILOSOPHY.md +++ b/PHILOSOPHY.md @@ -75,7 +75,7 @@ These are the beliefs chisel is built on: - **Ambient by default, ceremony on demand.** The discipline applies to every conversation (read the project context, plan first, verify before "done"). The agent detects when a chat has become real work and proposes - a task file — it never forces one. The one-shot fix stays cheap. + a task file — it never forces one. The quick fix stays cheap. - **Two designs, two moments.** The system design (how the pieces talk) is settled at creation time and reviewed there — a slice is ready to produce when it is settled, not before. The program design (files, signatures, diff --git a/project-management/000-template.spec.md b/project-management/000-template.spec.md index ccf219f..bcf091f 100644 --- a/project-management/000-template.spec.md +++ b/project-management/000-template.spec.md @@ -75,6 +75,7 @@ All spec documents MUST follow this structure: # **Status:** draft +**Review depth:** full | strategic [+ captures] [+ recording] [+ e2e] --- @@ -169,6 +170,18 @@ the `**Status:**` line: - **When a tracker holds the status**, the line says so — `**Status:** tracked as ` — and the status lives in the tracker only. +## Review depth + +The `**Review depth:**` line says how far down the human goes at the human +review, and which proofs the Architect asks for. It starts with one of the +two depths that step 8 of [workflow.md](/.agents/workflow.md) defines. +Each proof wanted follows after a `+`: `captures`, `recording`, `e2e`, as +in `strategic + captures`. The diff only adds a floor: a screen touched +brings captures even when the line leaves them out (the `visual-proof` +skill). Keep what the task needs. Or delete the line: the review section +of `.agents/project.md` then gives the default depth, and the only proofs +are the floor's. + ## When Creating New Tasks 1. Interview first when the intent is unclear; write from the task when it is clear. diff --git a/project-management/000-template.work.md b/project-management/000-template.work.md index f1bebf0..c990c9a 100644 --- a/project-management/000-template.work.md +++ b/project-management/000-template.work.md @@ -33,6 +33,11 @@ own — only its slices do. the Mason, then the approval goes on the `**Plan:**` line. Plan approval is that line, not a status. +**The close records the depth.** At the close the Mason writes the +`**Depth:**` line: the depth the spec chose, the floor the diff computed +with the `visual-proof` skill, and why the task went above the floor when +it did. The `retro` skill compares the two across tasks. + **The review writes into it.** `code-review` reports its findings, and the Mason records each one in the Diff-Review Findings section with its fix or its answer. @@ -50,6 +55,11 @@ Created by the Mason at the plan step, . Spec: **Plan:** waiting for the Architect's reading. +**Depth:** written at the close. + + ## Program Design Written at the plan step, from the spec's system design. Decisions, not diff --git a/project-management/JOURNAL.md b/project-management/JOURNAL.md index 5243170..bf61181 100644 --- a/project-management/JOURNAL.md +++ b/project-management/JOURNAL.md @@ -5,6 +5,149 @@ ships. --- +## 56. 2026-11-22 — A touched screen has a proof + +Slice 04 of the human-review task gives the review its second reading. +Two pieces ship in the socle: + +- the capture command, `.agents/skills/visual-proof/scripts/captures.ts`, + a copy of the Harness's `captures.ts` at a05b1092 with Olympe's + agreement and her three changes. It is the socle's first Node file; +- the `visual-proof` skill, the method of `verification-visuelle` made + generic: the text report first, never a capture read in the agent's own + thread, a fresh sub-agent when an image must be looked at. + +§J · Review declares the E2E, Recording and Screenshot commands, each +optional, and a committed proofs folder beside the spec; `chisel-setup` +asks for them. The spec's `**Review depth:**` line can ask for proofs, the +diff adds a floor (a screen touched means captures), the work document's +`**Depth:**` line records both at the close, and `retro` compares them. +The intentions `unreleased/review-proofs` (migration) and +`unreleased/visual-proof` tell updated repos. + +The Mason wrote the plan and a Sonnet Typist typed it; the browser test +ran for real against a local `playwright-core`. The fresh reviewers found +private names and topics left in the copied script's comments, which the +Mason removed as a retouch, with a test that now refuses them. This repo +has no front, so the slice's own close was the no-screen dry run: no +capture. The dry run on music-downloader is left open: there is no +checkout here, and `review-videos` is in no history. + +--- + +## 55. 2026-11-22 — A task can run in one shot + +Slice 03 of the human-review task gives a task a second lane. On +Pierrick's « En oneshot je n'interviens que pour la review finale. Et +encore. », `workflow.md` has a section called "The one shot". In it: + +- the Architect takes the one shot when it writes the spec, if it judges + the task small or the human asks; +- it writes a `**One shot:**` line in the spec, with the reason and + whether the final review is kept or skipped, and the pull request opens + with that line; +- the human's reading of the spec and the ruling on a plan that departs + from the human's decisions are removed, and the Architect rules on both; +- the code review, the gates, the close, the synthesis and the pull request + stay. + +The stops table gains an "In one shot" column. When the final review is +kept, the Architect says in so many words that approving it is the word for +the merge. Step 2 names `wayfinder` for a spec interview that tangles. The +old "one-shot", work done without a task artifact, is now "quick fix" in +`reference.md`, `discipline.md`, `methodology.md` and `PHILOSOPHY.md`. The +informational intention `unreleased/one-shot` tells updated repos. + +The Mason wrote the exact text and a Sonnet Typist typed it, with the gates +green. The Typist replaced discipline rule 3 with the plan's text, which had +missed the case of a spec with no new decision; the fresh reviewers caught +it. They also found the glossary defining a task where the workflow meant a +lane, and the roles paragraph and step 4 missing the one-shot exception. The +Mason fixed ten findings as retouches and answered six. One is left to the +Architect: the spec's Note says the one shot removes nothing at the plan, +and ruling 2a removes a stop there. + +--- + +## 54. 2026-11-22 — The Mason who did the work fixes the review's comments + +Slice 02 of the human-review task answers who fixes the human review's +comments. On Pierrick's « toujours le maçon qui a bossé ! Toujours. », step +8 of the workflow now has a paragraph called "Who fixes the comments". It +says: + +- the task's Mason is woken in its own session, however long ago it + closed; +- a fresh Mason starts from the archived documents only when that session + is lost; +- a comment that changes a spec decision goes into the spec first, written + by the Architect. + +The fix follows the discipline of a review finding. It goes through a +Typist unless it is a retouch, runs the gates and a fresh `code-review` on +its diff, and records each comment in the work document. The status stays +`done`. + +The rest of the workflow was brought into line. Step 7's "stop everything" +no longer ends the Mason's session. The Sub-agents section keeps a Mason +for its whole task, which replaces "a resumed task starts fresh". Step 4 +writes, on the `**Plan:**` line, the id the Mason's harness resumes it by, +so the Architect can find it after a compaction. This repo's `AGENTS.md` +widens ruling G16 to match. The informational intention +`unreleased/mason-fixes-the-comments` tells updated repos. + +The Mason wrote the exact text and a Sonnet Typist typed it, with the gates +green. Two fresh reviewers then found the following, all fixed by the Mason +as retouches: + +- a decision cited by its number; +- a bare step number; +- lines patched in place rather than reflowed; +- the lost-session rule written twice; +- "handle", which is not a glossary term. + +--- + +## 53. 2026-11-22 — The workflow gains a human review, opened on a synthesis + +The workflow used to end when the pull request opened, and the human then +read the diff with nothing to guide them. Slice 01 of the human-review task +adds step 8, *Human review*, which the Architect runs after the close. It +puts three readings in order: + +- the **synthesis**, one article page that the Mason writes at the close on + the frontier tier, where the human may stop with comments; +- the **proofs**, a place kept for the slice that fills it; +- the **reading guide**, the crit story on the pull request's diff, which + opens on the synthesis. + +A review depth, `full` or `strategic`, sets how far down the human goes. +Its default is in a new glue section, §J · Review, and a spec can change it +with a `**Review depth:**` line. Two rules come from the Harness: + +- the diff's base is read from the pull request, never assumed to be `main`; +- an expired wait resumes on the same review, so it is not a blocker. + +The synthesis template ships as `.agents/synthesis.md.tpl`, so every +update refreshes it. + +Two intentions cover the change. `unreleased/human-review-step` is +informational. `unreleased/review-section` is a migration that adds §J to +existing glues. The setup skill now asks the §J question. + +A Sonnet Typist typed the approved plan, and the gates were green. Two +fresh reviewers then found the following, and the Mason fixed each as a +retouch: + +- this repo's own `.agents/` lacked the template, so step 7 pointed at + nothing; +- the spec template pinned `full`, which would override a `strategic` + project; +- the meaning of the depth was restated in several files; +- the `init` test pinned the template's text. + +--- + ## 52. 2026-11-19 — Sub-agent briefs carry the runtime rules Sub-agents get only their brief, so the rules of the Harness that runs diff --git a/project-management/tasks/20261119-1644-relecture-humaine.spec.md b/project-management/tasks/20261119-1644-relecture-humaine.spec.md new file mode 100644 index 0000000..d354ee9 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine.spec.md @@ -0,0 +1,413 @@ +# Human review: a step of its own, with crit, visual proof and questions off the chat + +**Status:** draft — split in two (21/11): group A (slices 01-04) approved +by Pierrick on 22/11 and ready; group B waits on the review tool + +> **Two groups, two paces.** Pierrick (21/11): « P-e devrait ont split le +> chantier en 2 ? Les procédures / regles d'un coté qui ne necessitent pas +> forcément + d'outillage, et puis l'outil eensuite » ; « ça permettrait +> d'améliorer Chisel dès ajd ». +> +> - **A — the rules** (slices 01 to 04): the human-review step and its +> strategic reading, who fixes the comments, the one shot, the visual +> proof. They work with crit and plain files, need no new tool, and can +> start now. +> - **B — the tool** (slices 05 and 06): the questions page and the +> pre-development report. They wait on the tool the task +> `relecture-analyse` prepares, and are not rewritten here. Decision 8 +> waits with them. + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +## Context + +Chisel takes a task from intent to a pull request, then stops. Nothing in +`socle/agents/workflow.md` says how the human reviews that pull request, with +what tool, at what depth, or with which proofs. Today it lives outside +Chisel: in the Harness (the `crit` skills, Pierrick's story guide, the +`crit-review` script) and in a few projects' own rules (music-downloader's +"a Playwright spec for every UI path", its `review-videos` skill). + +Two more pains sit before the code: questions asked in the chat (no visual +proposal, no diagram, not asynchronous), and a spec that has to be found on +disk instead of being read in a browser. + +Source: the analysis page « Chisel, relecture en deux temps » (vault, +`23.17 Outillage/artefacts/2026-11-19`) and Pierrick's answers to it on +2026-11-19, quoted below. + +## Scope + +**Included:** +- A human-review step in `workflow.md`, with crit as the tool for now, + shipped by Chisel as a skill that points to crit (never a copy of crit). +- The review depth, written per task in the spec, and a lane whose only + possible human stop is the final review (the « one shot », first called + the autoroute). +- The strategic reading the human review opens on (decisions 21, 22). +- Visual proof when a screen is touched, and the agent's own check of it. +- Questions to the human, the pre-development report and the proofs as + pages that Chisel serves itself, written here as **needs**: what each page + shows and what it brings back. +- Who fixes the review's comments. +- An intention for every change under `socle/`. + +**Not Included:** +- The design of the tool that serves Chisel's pages. Pierrick leans to an + end-to-end review tool of our own (spec, questions, final review), built + from pieces of diffmap, crit and Plannotator; its 360 analysis runs as the + task `relecture-analyse`, and the prototype as `relecture-proto`. This + spec states the needs and leaves the tool open. +- Any fork of crit. +- Reworking the crit prologue prompt: done « petit à petit », elsewhere. +- The Harness's own pages (the gods' questionnaires and the like), which + head for Olympe. +- The queue, and anything that gathers several tasks, projects or + worktrees: that is the Harness (decision 23). Chisel works one task at a + time. + +## The decisions + +Each is marked **Pierrick** (quoted, settled), **proposed** (mine, waits +on his yes) or **open** (waits on something named). + +1. **crit ships with Chisel** — Pierrick: « ha Chisel n'embarque donc pas + Crit ? Je pense que je vais l'ajouter. Moins modulaire, mais ajd le but + c'est d'aller vite. » then « fais le ». It stays the review tool until + the tool of decision 16 replaces it. +2. **A human-review step in the workflow** — Pierrick (question 4 of the + analysis): « a. Mais c'est là où Chisel devrait certainement avoir un mode + "autoroute" -> avec les checks auto mais sans toutes les étapes dédiées à + l'humain uniquement ». +3. **The review weighs less on some projects** — Pierrick (question 5): the + project declares `human review: full | strategic` as its default, plus + the autoroute; « la relecture humaine devient moins prioritaire en + fonction des projets ». +4. **No questions inside a crit review** — Pierrick, 11-09: « Les questions + dans un Crit, c'est non ». A question goes to the questions page. +5. **A touched screen has a proof** — Pierrick (questions 6 and 7): at least + a screenshot, and a before → after comparison when the screen existed. + For the agent's own check, not shown to the human: a recorded Playwright + e2e test, or at least a check in the browser or with Playwright. +6. **Questions and the pre-development report are pages, in Chisel** — + Pierrick (question 8): « Pour moi c'est dans Chisel. Chisel c'est la + procédure de travail sur un sujet. C'est applicable aux agents non dev + aussi… » A page holds the thread; after the answers, an HTML report of + what will be done, « une sorte de .spec mais chargé dans le browser ». He + stays in herdr, the links always at hand. +7. **Step placement** — Pierrick (19/11): « ok ». Step 8, *Human review*, after the close + and the pull request; it reviews the pull request's diff (`crit --pr`, or + the branch diff without a remote), against the pull request's base, + not `main`, when pull requests are stacked. One task, one pull request, one human + review (11-09). +8. **The review skills** — open, waits on the review tool. Pierrick + (19/11): « attendons de settle sur un outil. Je pense que ça sera plus + large comme skill, ça touche comment lancer la review / preview / spec, + (p-e 3 skills ?) et ça pourrait appeler des sous skills pour + l'outillage ». So: likely several skills, one per thing the human reads + (launch the review, the preview, the spec), each calling a sub-skill for + the tool behind it. My first draft, a single `chisel-crit` skill plus a + story guide in `.crit/prompts/`, is set aside until the tool is chosen. +9. **A §J · Review section in `project.md`** — Pierrick (19/11): « ok ». + The project's + default depth, the e2e command, the recording command, the screenshot + command, and where the proofs are written. No command means no proof of + that kind, said in the review. +10. **Visual proof as a Chisel skill** — Pierrick (19/11): « yes ». + `visual-proof`, the + music-downloader `review-videos` skill made generic; the project gives + the commands through §J, the skill writes the proof files. Showing them + is the proofs page's job (decision 17). +11. **The Mason who did the work fixes the comments** — Pierrick (19/11): + « toujours le macon qui a bossé ! Toujours. Le relancer couter aussi + cher qu'un neuf : oui mais il a tout le bon contexte. » The task's Mason + is woken to fix the review's comments, however long ago it closed; a + fresh Mason only when its session is lost. When a comment changes a spec + decision, the Architect fixes the spec first, then wakes the same Mason. +12. **No resume summary** — withdrawn. With decision 11 the same Mason + fixes the comments with its own context; a summary would only serve a + lost session. Pierrick (19/11): « du coup pas utile ? », then « go » on + withdrawing it. +13. **The depth is a line of the spec, the diff a floor** — Pierrick + (question 1, 19/11): « Spec + plancher ». The Architect writes the depth + of the review in one line of the spec (for example « captures + e2e », + « stratégique seul »), starting from the project's default; the diff + only adds a floor (a screen touched means captures), never removes. + Path patterns in `project.md` are set aside. Pierrick adds: « On va + tester ça et faudra monitor que l'agent demande pas toujours PLUS que le + plancher, ce qui indiquerait un soucis. » So the close records, in the + work document, the depth chosen and the floor the diff computed, and + `retro` compares them: a task that asks more than the floor says why, + and a run of them is a finding of the retro. +14. **When the autoroute is taken** — Pierrick (question 2, 19/11): « Taille + de la tache ? Demande explicite ? », then « ok » to this wording. The + Architect takes the autoroute when it judges the task small at step 2, + or when the human asks for it explicitly; it writes the choice and its + reason in one line of the spec, and the pull request repeats it. On the + autoroute the code review and the gates still run and the pull request + is still opened; the stops that only serve the human (reading the spec, + reading the plan, the human review) are skipped. A human who asks for + the full lane always gets it. There is no project switch (ruling G10). + Amended on 21/11 by decision 18: the lane is named the one shot, the + spec reading is still skipped, and the final review becomes optional. +15. **The report before and the review after share one form** — Pierrick + (question 3, 19/11): « Intéressant. Pas sur que la vue en colonnes soient + la bonne, mais l'idée l'est. » The Mason fills, at the plan step, the + same parts the final review shows (what changes, in a sentence; the + files touched; the data model before → after; the flows as diagrams), + so the gap between planned and done shows at once. How the two are put + side by side (columns or otherwise) is the review tool's, left open. + Pierrick (on proposal 15, 19/11): « je pense que faut se concentrer sur + la UX : à quoi on veut que ça ressemble. Avant de s'arreter sur le + comment ». So the look of the report and of the review, shown as real + variants, comes before any choice of form or tool. +16. **Chisel serves its own pages** — Pierrick (question 4, 19/11): « Non je + porte que Chisel doit etre complètement autonome car des gens + l'utilisent hors Harness ! Si on doit se monter un système de petit + serveur à la crit, so be it ! Le Harness sa responsabilité pour les + pages html c'est autre chose (questionnaires des dieux, etc.) et ça + finirait plutot dans Olympe en fait ! » Chisel serves its pages and + brings the answers back to the agent by itself; it relies neither on the + Harness nor on Dédale's page tool. Which tool does it is left open (see + Not Included). +17. **The proofs live in Chisel's pages** — Pierrick (question 5, 19/11): + « je pense que mes réponses plus haut sont suffisantes ! » Screenshots, + comparisons and videos are shown in a page Chisel serves, not in the + crit story. + +Decisions of 21/11, from Pierrick's notes on the page « Relecture, parcours +et fonctionnalités » (vault, `23.17 Outillage/artefacts/2026-11-19`): + +18. **The one shot** — Pierrick (21/11): « Sur 7 8 9 j'interviens + uniquement quand on est pas en mode ~ "one shot" ». Steps 7, 8 and 9 of + the page are *review*, *fix the comments* and *merge*. The autoroute of + decisions 2 and 14 takes this name. Then, answering question A2 of the + 21/11 report: « En oneshot je n'interviens que pour la review finale. + Et encore. », and question A4 (does the one shot keep the spec + reading?): « non ». So in one shot there is no spec reading; the only + human stop left is the final review, and it may be skipped too: the + Architect's one-shot line in the spec says whether it happens. The page + said « il s'arrête à la spec »; Pierrick's answers replace it. + *Proposed* for the merge: when the final review happens, Pierrick's + approval there is his word for the merge; when it is skipped, the merge + follows the merge and publish section of `project.md` (by default, his + explicit word). +19. **Clarifying only when needed** — Pierrick (21/11): « A ne pas lancer + si le besoin est archi clair » ; « Voir wayfinder si ça semble trop le + bordel ». The interview of step 2 (`grilling`) is skipped when the need + is clear, as `workflow.md` already says; when it gets tangled, the + Architect switches to the `wayfinder` skill, a map of decision tickets. +20. **The spec stays a document** — Pierrick (21/11): « Le document ne doit + pas disparaitre. Mais efectivement une vue web nous donne + de + leviers. » The spec stays a file on disk; a web view comes on top of it + with group B's tool, never in its place. +21. **The strategic reading comes first** — Pierrick (21/11): « Ici ça doit + se lire aussi bie nqu'un bon article. Après avoir relu ça je devrais + déjà voir un gros niveau de confiance, et le cas contraire je stop ici + direct avec commentaires » ; « j'ai jamais demandé en 1 phrase. Surtout + pas. C'est au max une page d'article » ; it carries « uniquement le plus + critique notamment le schema de données mais aussi effectivement un + grand changement d'archi ». The human review opens on a synthesis: what + was done and why for the critical decisions, the data schema before → + after and any large architecture change, one article page at most, + never one sentence. If it gives him confidence, Pierrick goes down or + approves; otherwise he stops there, with comments. +22. **Three readings** — from the same notes: the human review has three + readings, highest first: the *strategic* one (the synthesis), the + *proofs* (captures, before → after, video, command output) and the + *reading guide* (the diff in chapters, the core first). The page's + « System » card is merged into the strategic reading. The depth line of + the spec (decision 13) says how far down the human goes: `strategic` + stops at the synthesis, plus the proofs the floor demands; `full` goes + to the guide. +23. **The queue is the Harness** — Pierrick (21/11), on the queue and + anything that gathers several tasks: « ça c'est un peu mon harness + actuel. Chisel c'est la couche juste en dessous, restons en là pour le + moment ». +24. **The visual proof starts from the Harness's method** — Pierrick + (21/11): « on a quelque chose dans le harness ». That is the script + `captures.ts` (Playwright captures written to disk, a pixel comparison + with a `.diff.png` map, and a text report: overflow, console errors, + off-site requests) and the skill `verification-visuelle` (mechanical + first; an agent never reads a capture in its own thread; a fresh + sub-agent looks when needed and reports « non vérifié » for what it + cannot see). Chisel must work without the Harness (decision 16), so + slice 04 carries an equivalent inside Chisel. The code of `captures.ts` + belongs to Olympe: a copy needs Olympe's agreement, asked by promethee. + Pierrick (21/11, question A3): « a »: `captures.ts` is copied, in Node, + once Olympe agrees; Chisel does not rewrite it. Olympe agreed the same + night, with three things to make generic; slice 04 carries its words. +25. **The Mason writes the synthesis** — Pierrick (21/11, question A1): + « faut un bon modele. Le mason pour test ». The task's Mason writes the + synthesis of decision 21 at the close, because it holds the why, on a + strong model (never the light tier). It is a trial: the retro of the + first tasks says whether it holds. + +## The pages, as needs + +What each page must do, whatever tool serves it: + +| Page | When | Shows | Brings back | +|---|---|---|---| +| Questions | step 2, and whenever an agent has a question for the human | each question with its options, a recommendation, a mockup or diagram when it helps | the answers, to the agent that asked, without the chat | +| Pre-development report | the plan step | what changes, the files touched, the data model before → after, the flows; the spec readable in the browser | the human's go or remarks | +| Proofs | the human-review step | screenshots, before → after, videos | nothing; linked from the review | + +Each page is reachable by a link the agent gives the human, opens outside +the Harness, and is served by Chisel. + +## Acceptance Criteria + +- [ ] **workflow-has-human-review** — `socle/agents/workflow.md` has a step + named *Human review*, after the close, and its "Where the work stops" + table lists it. +- [ ] **autoroute-written** — `workflow.md` names the one shot, what it + skips and what it keeps, and when the Architect takes it. +- [ ] **strategic-reading-written** (2026-11-21) — `workflow.md`'s human + review opens on a synthesis of one article page at most, written from a + template the socle ships, by the task's Mason at the close, and says + the human may stop there. +- [ ] **capture-tool** (2026-11-21) — Chisel ships a capture command that + writes captures, a before → after pixel comparison and a text report, + with no Harness command involved. +- [ ] ~~**crit-skill-ships** — `socle/agents/skills/chisel-crit/SKILL.md` + exists, is listed in `src/socle-files.ts`, and contains no copy of crit's + own skills.~~ +- [ ] ~~**story-guide-placed** — `chisel-setup` on an empty repo produces + `.crit/prompts/on_story_generate.md`, and crit uses it there (checked with + `crit story --guide`).~~ +- [ ] **review-skills** (2026-11-19, replaces the two above; written once + the tool is chosen) — the skills that launch the review, the preview and + the spec ship in `socle/agents/skills/`, are listed in + `src/socle-files.ts`, and copy no external tool's own skills. +- [ ] **project-review-section** — `socle/agents/project.md.tpl` and this + repo's `.agents/project.md` have a §J · Review section. +- [ ] **visual-proof-skill** — `socle/agents/skills/visual-proof/SKILL.md` + exists, reads its commands from §J, and names no command of one project. +- [ ] **depth-against-floor** — the work-document template records the + depth chosen and the floor computed, and the `retro` skill compares them. +- [ ] **pages-without-harness** — the questions page and the report are + served by Chisel, and an answer given on the questions page reaches the + agent, with no Harness command involved. +- [ ] **who-fixes-written** — `workflow.md` gives the rule of decision + *who fixes the comments*. +- [ ] **intention-per-change** — every change under `socle/` has its + intention in `socle/intentions/unreleased/`; the Intention gate passes. +- [ ] **suite-green** — `deno task check` and `deno task test` pass. + +## Seams + +- Seam: `workflow.md` — an agent following it reaches a human-review step, + or skips it in autoroute, and knows who fixes the comments. +- Seam: `chisel-setup` / `chisel update` — an equipped repo has the §J + section, and, once the tool is chosen, what the review skills need. +- Seam: Chisel's pages — an agent hands the human a link; the human reads + and answers in the browser; the answers come back to the agent. Outside + this seam, the tool is free. + +## Architecture + +```mermaid +flowchart LR + S[spec
+ depth line] --> Q[questions page] + Q --> P[plan
+ pre-dev report] + P --> C[code + agent's check
e2e / browser] + C --> R[close + PR] + R --> H[human review
synthesis, then proofs, then guide] + H -->|comments| F[who fixes] + F --> R + S -. one shot .-> P2[plan] --> C2[code + checks] --> R2[PR] +``` + +Chisel ships all of it: the step text, the review skills (decision 8, +open) and `visual-proof`, §J, and the pages with what serves +them. The Harness keeps only Pierrick's own setup (the `crit-review` script +that listens on the tailnet) and its own pages. + +--- + +> 🧑 **REVIEW IF RELEVANT** — decisions, testing, slicing. + +## Implementation Decisions + +- An external tool is never copied: the skill points to it, says how to + install it and when to call it (the Harness rule on external skills). +- crit stays unforked: small additions go upstream (question 3 of the + analysis). +- Content written for agents goes through `writing-for-agents` + (`CONTRIBUTING.md`). +- Each slice adds its own intentions; the release promotes them. + +## Testing Strategy + +- `test/integrity.test.ts` catches a new socle file not listed. +- A test runs `chisel-setup`'s placement on an empty folder and checks §J + and the synthesis template appear. +- A dry run on music-downloader (screens, e2e, recording) validates + `visual-proof` before it ships; a dry run on a repo without front checks + that no screen means no capture. +- A test answers the questions page and reads the answer on the agent's + side. + +## Slices & Dependencies + +Folder `20261119-1644-relecture-humaine/`: + +Group A, the rules, starts now: + +1. **Human review with crit** (blocked by: none) — the step and §J with the + default depth; the strategic reading first, with the possible stop + (decisions 21, 22); the review skills join once the tool is chosen. +2. **Who fixes the comments** (blocked by: 1) — the task's Mason, always; + no resume summary (decision 12). +3. **One shot** (blocked by: 1) — no spec reading, the final review the + only stop left and optional; Clarifier skipped when the need is clear, + `wayfinder` when it tangles (decisions 18, 19). +4. **Visual proof** (blocked by: 1) — `visual-proof`, the capture command + and the method of decision 24, §J commands, the agent's own check, the + depth against the floor; the proofs are files until group B's tool + shows them. + +Group B, the tool, waits on `relecture-analyse`: + +5. **Questions page** (blocked by: the review tool chosen after + `relecture-analyse`, and the UX of decision 15) — Chisel serves the page and brings the answers + back; questions leave the chat. +6. **Pre-development report** (blocked by: 1 and 5) — the shared form of + decision 15, its look settled first, and the proofs page on the same + tool. + +## Deliverables + +- [ ] The six slices, each with its intention(s) and a passing gate. + +## References + +- Analysis page « Chisel, relecture en deux temps » (vault, 23.17 + Outillage, 2026-11-19): the four-part review folder and the nine + questions this spec answers. +- `project-management/review-360-decisions.md`, rulings E4 and G10: the + earlier light lane and the « no switch » rule decision 14 honours. +- Vault notes « Chisel, reprise après la review humaine » and « Chisel, coût + des Masons et relecture du plan » (2026-11-04): the source of the first + drafts of decisions 11 and 12. +- Vault note « Chisel, règles de travail et crit » (2026-11-09): the rules + to bring from the Harness into Chisel, source of the first draft of + decision 8. +- music-downloader, `.claude/skills/review-videos/SKILL.md`: the skill that + decision 10 makes generic. +- Apollon, `outils/formulaire.mjs`: a 31-line questions form, one input for + the tool of slice 5. + +## Notes + +- If crit stays the tool: its project-prompt trust gate is unverified (is a + committed `.crit/prompts/` file used without a manual trust step?), and + `.crit/prompts/` sits outside `.agents/`, a new placement for + `chisel-setup`. + +## Retrospective + +_At the close._ diff --git a/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.spec.md b/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.spec.md new file mode 100644 index 0000000..391dc3b --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.spec.md @@ -0,0 +1,77 @@ +# 01 — Human review with crit + +**Status:** done — closed by the Mason on 2026-11-22; spec, work and synthesis stay in the slice folder until the parent closes (sliced-task archive rule) +**Blocked by:** None — can start immediately + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +**What to build:** after the close and the pull request, an agent following +the workflow reaches a *Human review* step. The review opens on the +**strategic reading**: a synthesis of what was done and why for the +critical decisions, with the data schema before → after and any large +architecture change, and nothing less critical. The task's Mason writes it +at the close, on a strong model (never the light tier), as a trial. It reads like a good +article, one page at most, never one sentence. Pierrick reads it first: +if it gives him confidence, he goes down to the proofs and the reading +guide, or approves; otherwise he stops there and comments, and the review +goes no further. + +Below it come the two other readings: the proofs (slice 04) and the reading +guide, which for now is the crit story on the pull request's diff, written +with the project's story guide. The spec's depth line says how far down the +human goes: `strategic` stops at the synthesis, plus the proofs the floor +demands; `full` goes to the guide. The agent waits for the human and +answers every comment; no question goes into crit. + +Two rules from the Harness's use of crit, raised by the Architect of +`chisel-workflow` (21/11): + +- **The diff's base is the pull request's base.** On stacked pull + requests the base is not `main`: the step reads it from the pull request + (`gh pr view --json baseRefName`) and reviews the diff against it. +- **An expired wait is not a blocker.** When the wait for the human times + out, the agent reconnects to the same review and waits again; it reports + a blocker only on another failure. + +A freshly equipped repo has a §J · Review section declaring its default +depth (`full` or `strategic`). The socle ships a synthesis template. The +review skills (parent spec, decision 8) wait on the review tool; until +then the step calls crit directly. Parent spec: decisions 1, 2, 3, 4, 7, 9, +21, 22, 25. + +## Acceptance criteria + +- [x] **workflow-has-human-review** — `workflow.md` has the step, and its + "Where the work stops" table lists it. +- [x] **strategic-reading-written** — the step opens on the synthesis, + names what it carries and its length (one article page at most), and + says the human may stop there with comments. +- [x] **synthesis-template** — a synthesis template ships in the socle, is + listed in `src/socle-files.ts`, and has a place for the data schema + before → after and for a large architecture change. +- [x] **three-readings-ordered** — the step names the three readings in + order (strategic, proofs, reading guide) and maps the depth line onto + them. +- [x] **diff-base-from-pr** — the step takes the diff's base from the + pull request, not from `main`. +- [x] **expired-wait-resumes** — the step says an expired wait reconnects + to the same review and waits again, and is not a blocker. +- [x] **project-review-section** — the project template and this repo's + `project.md` have §J with the depth. +- [x] **intention-per-change** — the Intention gate passes. +- [x] **suite-green** — `deno task check` and `deno task test` pass. + +--- + +> 🧑 **REVIEW IF RELEVANT** — notes written before the work document exists. + +## Notes + +- Who writes the synthesis: the Mason, on a strong model, as a trial + (parent spec, decision 25). Where Pierrick reads it while crit is the + tool is the plan's to propose: a markdown file in the task folder, + committed in the pull request, which the crit story opens on. +- Sources: the page « Relecture, parcours et fonctionnalités », step 7 + « Relire » and notes 7, 8, 11 of 21/11. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.synthesis.md b/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.synthesis.md new file mode 100644 index 0000000..92cdc4a --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.synthesis.md @@ -0,0 +1,70 @@ +# Synthesis — Human review with crit (slice 01) + +## What changed and why + +Until now the workflow ended when the Architect opened the pull request. +After that, the human's reading was left to chance: no order, no stopping +point, and the diff was always read whole. This slice adds that reading as +a step of its own, **step 8, Human review**, run by the Architect after the +close and before any merge. + +The step puts three readings in order, from the most critical down. First +comes a **synthesis**: one page, written by the Mason at the close, saying +what changed and why for the decisions that matter. If it does not give the +human confidence, the human stops there with comments and the review goes +no further. Next come the **proofs**. Their place is reserved here and the +proofs slice fills it. Last comes the **reading guide**: the crit story +written on the pull request's diff. Its first chapter is the synthesis +itself, so even inside crit the human starts at the top. How far down the +human goes is set by a **review depth**, `full` or `strategic`. Each project +declares a default in a new §J of its glue, and a spec can set its own. + +Two lessons from the Harness are now rules of the step. The diff's base is +read from the pull request, because stacked pull requests do not target +`main`. A wait that times out is resumed on the same review rather than +reported as a blocker. + +## Critical decisions + +- **The synthesis template lives in `.agents/`, not beside the spec and + work templates.** `update` writes a file outside `.agents/` only if the + previous install already listed it. A new template under + `project-management/` would therefore reach fresh installs only, never + repos already equipped. This template is a trial and will change, so it + has to travel with every update. The cost: it sits apart from the other + two templates. +- **The synthesis is a file in the task folder, committed in the pull + request.** It sits beside the spec as `.synthesis.md`. Because it is + part of the diff, the crit story can open on it without any change to + crit. The alternative, a separate page outside the repo, would have left + no trace and needed a second tool. +- **The Mason writes it, on the frontier tier.** The Mason holds the whole + task in context at the close. Pierrick's "not Sonnet" rules out the mid + tier as well as the light one. +- **The base is always read and passed explicitly** + (`gh pr view --json baseRefName`, then `--base-branch`), rather than + trusting crit's pull-request mode to find it. This also covers a branch + with no pull request on a forge. +- **The spec template's depth line reads `full | strategic`.** The writer + keeps one value, or deletes the line to take the project's default. The + review caught that a pre-filled `full` would silently override a project + set to `strategic`. +- **When crit is missing, the step stops for the human.** It says where to + get crit (https://crit.md) rather than falling back to a review without + it. + +## Data schema, before → after + +No data schema change. Two project files change shape: + +- **The glue:** sections A–I → A–J. A new `## J · Review` section holds one + item, `- **Default depth:** full | strategic`. The migration intention + `unreleased/review-section` adds it to repos already equipped. The setup + skill now asks about it. +- **The spec header:** `**Status:**` → `**Status:**` followed by + `**Review depth:** full | strategic`, which the writer may delete. + +## Architecture change + +None. The installer copies one more file (`.agents/synthesis.md.tpl`), the +same way it copies `user.md.tpl`. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.work.md b/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.work.md new file mode 100644 index 0000000..3af36f6 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.work.md @@ -0,0 +1,342 @@ +# 01 — Human review with crit — work + +Created by the Mason at the plan step, 2026-11-22. Spec: +`project-management/tasks/20261119-1644-relecture-humaine/01-human-review-with-crit.spec.md`. + +**Plan:** approved by the Architect, 2026-11-22, with these rulings on the +Mason's questions: (1) the template lives at `.agents/synthesis.md.tpl`; +(2) yes, add `**Review depth:** full | strategic` to the spec template and +a sentence in step 2 (parent decision 13 already makes it a line of the +spec); (3) yes, the chisel-setup §J question is in this slice; (4) a repo +without crit: the step says where to get it and stops for the human; +(5) always read `baseRefName` and pass `--base-branch`. One correction: +the synthesis is written on the **frontier** tier, not « never the light +tier » — Pierrick's « pas Sonnet » excludes the mid tier too (decision 25). + +## Program Design + +### Files touched + +| File | Change | +|---|---| +| `socle/agents/synthesis.md.tpl` (new) | The synthesis template. | +| `src/paths.ts` | `SOCLE.synthesisTemplate = "socle/agents/synthesis.md.tpl"`. | +| `src/install.ts` | One `COPIED_FILES` entry: `[SOCLE.synthesisTemplate, ".agents/synthesis.md.tpl"]`, beside the `user.md.tpl` entry. | +| `src/socle-files.ts` | The template and the two intentions, sorted. | +| `test/fixtures/golden-tree.txt` | `.agents/synthesis.md.tpl` added. | +| `test/init.test.ts` | One case: §J and its depth line are in the generated `project.md`, and the template is installed. | +| `socle/agents/workflow.md` and `.agents/workflow.md` | Step 7 writes the synthesis; new step 8; one new row in the stops table; "After the close" amended. Both copies byte-identical. | +| `socle/agents/project.md.tpl` | New `## J · Review` section; header comment says A–J. | +| `.agents/project.md` | The same §J, filled for this repo (`full`). | +| `socle/agents/skills/chisel-setup/SKILL.md` and `.agents/skills/chisel-setup/SKILL.md` | A §J question; "A through I" becomes "A through J". | +| `socle/intentions/unreleased/human-review-step.md` (new) | Informational intention. | +| `socle/intentions/unreleased/review-section.md` (new) | Migration intention: add §J to an existing `project.md`. | +| `test/TESTS.md` | The `init` row names §J and the synthesis template (one clause). | + +| `socle/templates/000-template.spec.md` and `project-management/000-template.spec.md` | A `**Review depth:** full \| strategic` line in the header (ruling 2). | + +Untouched: crit itself, `reference.md`. + +### Where the synthesis template lives + +`socle/agents/synthesis.md.tpl`, installed as `.agents/synthesis.md.tpl`. +Same mechanism as `user.md.tpl`. Why not `project-management/` beside the +spec and work templates: `update` writes a file outside `.agents/` only when +the last manifest already listed it. A new template there would reach fresh +installs and never existing ones. The template is a trial and will change; +under `.agents/` every `update` refreshes it, `check` sees drift, and the +integrity test checks the step's pointer to it. + +### The template's shape + +The template has a short header comment (who writes it, when, for whom, +one article page at most, never one sentence, critical decisions only), +then four headings: + +1. **What changed and why**: two or three paragraphs of prose. +2. **Critical decisions**: each with its reason and the alternative left + aside. +3. **Data schema, before → after**: a before/after pair, or "No schema + change." on one line. +4. **Architecture change**: the large change, or "None." on one line. + +No proofs and no file-by-file account. Those are the two other readings. + +### The synthesis file + +- **Where it lives:** beside the spec of what the PR delivers, named by + replacing `.spec.md` with `.synthesis.md`. For a sliced task that is the + slice. +- **Who writes it:** the Mason, at step 7 (close), before archiving, on + the frontier tier (decision 25: not the mid tier either). The step says + « frontier tier » in those words. +- **What happens to it:** it is archived with the spec and work documents + and committed in the PR. + +### How the crit story opens on it + +The synthesis is part of the PR diff, so crit needs no change. Step 8 tells +the Architect what to do when writing the story with `crit story --guide` +and the project's guide: + +- the first chapter holds only the synthesis file's hunk; +- the prologue says to read it first and that the review may stop there. + +The proofs (slice 04) come next, then the code chapters. + +### How step 8 reads the PR base + +1. `gh pr view --json number,baseRefName` gives the base. Never assume + `main`. +2. The story is prepared and ingested with `--pr --base-branch `. +3. The wait is `crit --pr --base-branch `, run in the background. +4. Without a forge PR (no remote), the step reviews the branch diff with + `--base-branch `, where the base is the branch the work was cut + from. + +### Step 8 text: what it must say (workflow.md) + +The heading is `### 8. Human review — Architect`, placed after "After the +close — Architect", in the same register as the other steps. In order: + +- **Entry:** the PR is open and the synthesis is committed in it. +- **The three readings, in order:** + - strategic: the synthesis. What it carries, one page at most. The human + may stop there with comments, and the review goes no further. + - proofs: what the floor demands. Slice 04 fills this in. + - reading guide: the crit story on the PR diff. +- **Depth:** + - the spec's depth line, falling back to §J's default; + - `strategic` = the synthesis plus the proofs the floor demands; + - `full` = down to the guide. +- **Base:** the base comes from the PR (see above). +- **Waiting:** + - the agent waits for the human and answers every comment; + - no question goes into crit; questions go to the human in conversation; + - an expired wait re-runs the same crit command (or `crit --session `) + and waits again. It is not a blocker; only another failure is. +- **Missing crit:** if `crit` is not installed, the step names where to get + it (https://crit.md, then `crit install `) and stops for the human + (ruling 4). +- **Exit:** the human approves, or comments are answered and addressed; + merging still follows `.agents/project.md`'s merge and publish section. + +Room for later slices: + +- slice 03 adds the one-shot sentence to this step; +- slice 04 fills in the proofs reading and adds commands to §J. + +Neither needs a restructuring: each reading is its own short paragraph. + +### Other workflow.md edits + +- **Step 7 (close):** + - the Mason writes the synthesis from `.agents/synthesis.md.tpl`, on the + frontier tier; + - the archiving sentence moves the synthesis with the spec and work + documents. +- **"After the close":** the merge waits for step 8. +- **"Where the work stops" table:** one row: the Architect, at the human + review, waiting for the human's reading. +- **Statuses table:** unchanged. `done` is left by step 7; the review is + of a PR, not a status. + +### §J · Review (project.md.tpl and .agents/project.md) + +The section is a comment, then the depth line: + +```markdown +## J · Review + + + +- **Default depth:** full +``` + +Slice 04 appends its commands and the proofs location under it. It is parsed +by `src/glue.ts` like any lettered section; nothing in `src/` reads it yet. + +### The spec's depth line (ruling 2) + +- Spec template (socle and this repo's copy, kept identical): under + `**Status:** draft` in the template block, add + the line `**Review depth:** full`. After the template's "## Statuses" + section, add a short "## Review depth" section: the value is `full` or + `strategic`; it says how far down the human goes at the human review + (step 8 of [workflow.md](/.agents/workflow.md)); omitted, the review + section of `.agents/project.md` gives the default. +- workflow.md step 2: one sentence: the spec carries the review depth + line, `full` or `strategic`, when the task departs from §J's default. +- The diff stays a floor (parent decision 13): `strategic` never skips the + proofs the floor demands. + +### chisel-setup + +- Walking A–J: one verbatim question for §J ("full or strategic, + recommended full") in the same style as the §I question. +- Step 7 and the summary wording go from A–I to A–J. + +### Intentions + +- `unreleased/human-review-step`: informational (`copy`). + - The workflow gains step 8. + - crit is needed on the machine that runs it. + - The synthesis template arrives by copy. + - Reference Paths: `workflow.md` and `synthesis.md.tpl` (copy). +- `unreleased/review-section`: migration. + - Add §J with a depth to the repo's `project.md`. + - Modelled on `0.2.0/04-merge-and-publish-section.md`: `.agents/project.md` + adapt, `chisel-setup/SKILL.md` copy. + +Each has the nine sections in order (the integrity test enforces it). + +### Tests and their order + +Tests check behaviour only. TESTS.md says no test pins prose, so ACs about +what the step says are verified at review, not committed. + +1. **Template ships:** + - write the `init` test first (red: no `.agents/synthesis.md.tpl`, no §J); + - add the template, the `SOCLE` key, the `COPIED_FILES` entry, the + socle-files line and the golden tree line; + - the template half of the test turns green, and the integrity listing + test passes. +2. **§J:** + - add §J to `project.md.tpl`: the test turns fully green; + - add §J to this repo's `.agents/project.md`. +3. **workflow.md:** step 7, step 8, the stops row and "After the close" in + `socle/`, then copied to `.agents/`. The integrity pointer test checks + `.agents/synthesis.md.tpl`. +4. **Depth line:** the spec template line (both copies) and the step 2 + sentence (both workflow copies). +5. **chisel-setup:** the §J question and the A–J wording, mirrored. +6. **Intentions:** the two files and their socle-files lines. The intention + parse test is green and `deno task release-check gate origin/main` + passes. `human-review-step` also names the spec template's new line. +7. **Gates:** `deno task check`, `deno task test`; TESTS.md row. + +A commit at each green step. + +## Worklog + +- 2026-11-22: plan written. Read the slice spec, the parent spec, workflow.md, + project.md.tpl, chisel-setup, install.ts, paths.ts, manifest.ts, + socle-files.ts, the integrity tests, TESTS.md and the crit story CLI. +- 2026-11-22: plan revised after the Architect's rulings: frontier tier for + the synthesis, the spec depth line, crit's source (https://crit.md). +- 2026-11-22 (Typist): typed the plan. The `init` test failed first (no + `.agents/synthesis.md.tpl`), then went green with the template and §J. + Deviations, for the Architect: step 8 is a bold-lead paragraph + (`**8. Human review — Architect.**`), not a `###` heading, to match steps + 1–7; it sits after "After the close". chisel-setup also moved its + "hand-added `## I`" example to `## K` and "after §I" to "after §J". The + `Review depth` line sits directly under `**Status:**` in the spec + template. Gates: `deno task check`, `deno task test` (77 passed) and + `deno task release-check gate origin/main` green. + +## Implementation Checkboxes + +- [x] `init` test for the template and §J (red) +- [x] Synthesis template, `SOCLE` key, `COPIED_FILES` entry, socle-files, golden tree +- [x] §J in `project.md.tpl` (test green) and in `.agents/project.md` +- [x] workflow.md: step 7, step 8, stops row, "After the close"; mirrored to `.agents/` +- [x] Spec template depth line (both copies) and the step 2 sentence +- [x] chisel-setup: §J question, A–J wording; mirrored +- [x] Intentions `human-review-step` and `review-section`, listed +- [x] TESTS.md `init` row +- [x] `deno task check`, `deno task test`, intention gate green + +## Notes & Snippets + +- `updateWrites` (src/install.ts) writes a file outside `.agents/` only if it + is in `previous.managed` and still exists. That is why the template is + not under `project-management/`. +- crit (main-ced1f6b): + - review: `crit --pr `, `--base-branch`, `--scope layer|full-stack` + (default layer for a PR), `--session ` to reconnect; + - story: `crit story --guide`, `--prep `, `--story-file `; + - waiting: run `crit` in the background until Finish Review; on a timeout, + re-run. +- project.md.tpl's header comment still says "sections A–H" although I + exists; fixed to A–J in passing. + +## Diff-Review Findings + +`code-review` since 43af38e, 2026-11-22: two fresh reviewers, Standards and +Spec. The fixes are a Mason retouch of a few lines (workflow step 5 +exception), made after the Typist's hand-back; gates green after them +(`deno task check`, `deno task test` 77 passed). + +- **This repo's `.agents/synthesis.md.tpl` was missing** (both reviewers). + Step 7 of this repo's own workflow pointed at nothing; the integrity test + only checks a freshly installed target. Fixed: copied from the socle. +- **The spec template pinned `full`** (Standards). Every spec copied from it + would silently override a project whose §J says `strategic`. Fixed: the + line reads `full | strategic` (the Architect's ruling 2 literally), and + the template's "Review depth" section says to keep one value or delete + the line to take §J's default. +- **The depth's meaning was written in several places** (Standards). + Fixed in part: the §J comment (template and this repo) and the spec + template now point at step 8 instead of redefining `full` and + `strategic`. Kept: the chisel-setup question, which a human reads without + the workflow at hand, and the intentions, which travel alone. +- **The synthesis contents are listed both in the template and in step 8** + (Standards). Answered: the criterion "strategic-reading-written" asks the + step itself to name what the synthesis carries; the template carries the + form. +- **"Never one sentence" was missing from step 8** (Spec). Fixed: the + bullet now says "One article page at most, never one sentence" and "any + large architecture change". +- **The proofs bullet was circular** (Spec). Fixed: "read after the + synthesis and before the guide". Its one sentence is the place the proofs + slice replaces. +- **Step 7's rewrap left an overlong line** (Standards). Fixed. +- **The `init` test pinned template text** (Standards). Fixed: it reads §J + through `parseGlue` and checks the `Default depth` item's value, so the + prose around it can change. The stat on `.agents/synthesis.md.tpl` + overlaps the golden tree; kept, since the parent spec's testing strategy + asks for that check by name. +- **The intentions landed in a commit after the socle change** (Standards, + soft). Answered: CONTRIBUTING and the Intention gate work at the pull + request, which carries both; the squash merges them into one commit. +- **The stops-table row overlaps step 8** (Standards, judgement). Answered: + the table is the summary of every stop, and the criterion + "workflow-has-human-review" asks for the row. +- **Parent decision 13's close record (depth chosen and floor computed, + compared by `retro`) is not in step 7** (Spec). Answered: decision 13 is + not in this slice's list, and the floor is computed by the proofs work; + left to the Architect to place, most likely slice 04. +- **crit treated as an outside install, against parent decision 1 "crit + ships with Chisel"** (Spec, noted). Answered: ruling 4. + +## Architect's rulings on the close — 2026-11-22 + +- **Archive:** agreed, the slice 01 files move with the parent's folder when + the last slice of group A closes. +- **Parent decision 13's close record** (depth chosen, floor computed, + compared by `retro`): goes to slice 04, whose criterion + `depth-against-floor` already owns the depth against the floor. Its Mason + adds the line to step 7. +- **chisel-setup §J question:** read, accepted as written. +- **Retro proposals** (integrity test of `.agents/` against `socle/agents/`, + the sliced-task archive sentence in step 7, the intention-in-same-commit + wording): not applied here; carried to Pierrick in the PR report. + +**Human review (PR #9)** + +- **« Est-ce que tous les skills ont utilisé /writing-for-agents ? »** + No: the slice wrote chisel-setup's review-depth question without that + skill. Fixed in 92981e7, the task's Mason, 2026-11-22. The first §J + question went through `writing-for-agents`, with no change of meaning: + the options name what is read, the task override points at the spec's + `**Review depth:**` line, and the closing line names the two values and + the next question. The A–J wording and slice 01's part of the defaults + line read clean and stay. Gates green. +- **Code review of the pass** (fresh reviewers, diff since 97a27f9, slice + 04's commits included). Slice 01's one finding: Full had lost « whole » + and named a « crit reading guide » that step 8 calls the reading guide. + Fixed: « then the whole diff through the reading guide ». The findings + on visual-proof and on §J's second question belong to slice 04's text + and go to the Architect. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.spec.md b/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.spec.md new file mode 100644 index 0000000..169627b --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.spec.md @@ -0,0 +1,30 @@ +# 02 — Who fixes the comments + +**Status:** done — group A, approved by Pierrick on 22/11 (ffaf5ec); closed by the Mason 22/11 +**Blocked by:** 01 — Human review with crit + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +**What to build:** when the human review leaves comments, the Mason who did +the work is woken to fix them, however long ago it closed; a fresh Mason +only when its session is lost. When a comment changes a spec decision, the +Architect fixes the spec first, then wakes the same Mason. Pierrick: +« toujours le macon qui a bossé ! Toujours. » Parent spec: decision 11; +decision 12, the resume summary, is withdrawn. + +## Acceptance criteria + +- [x] **who-fixes-written** — `workflow.md` says the task's Mason fixes the + comments, names the lost-session exception, and the spec-first case. +- [x] **intention-per-change** — the Intention gate passes. +- [x] **suite-green** — `deno task check` and `deno task test` pass. + +--- + +> 🧑 **REVIEW IF RELEVANT** — notes written before the work document exists. + +## Notes + +_None yet._ diff --git a/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.synthesis.md b/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.synthesis.md new file mode 100644 index 0000000..f8edc40 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.synthesis.md @@ -0,0 +1,65 @@ +# Synthesis — Who fixes the comments (slice 02) + +## What changed and why + +Slice 01 gave the human review its own step, but it left one question open: +once the human has commented, who does the work? The workflow even leaned +the wrong way. It said a Mason is reused "within a live thread" and that "a +resumed task starts fresh", and step 7 told the Mason to "stop everything" +at the close. An Architect reading it could fairly start a new Mason on the +comments, which would mean paying to rebuild a context that already +existed. + +Your ruling was « toujours le maçon qui a bossé ! Toujours. », and step 8 now +says it in a paragraph of its own, **Who fixes the comments**. A comment +that asks for a change goes to the task's Mason, the one that planned, coded +and closed the task. The Architect wakes it in its own session, however +long ago it closed. Waking it costs as much as starting a fresh one, but it +already holds the whole context. A fresh Mason is used only when that +session is lost, and it starts from the archived spec, work and synthesis +documents. When a comment changes a decision of the spec, the Architect +writes the new decision into the spec first, then wakes the same Mason on +it. + +The rest of the workflow now agrees with that paragraph: +- step 7 says the close does not end the Mason's session; +- the Sub-agents section keeps a Mason for its whole task; +- the roles table, the stops table and the Mason brief list the new turn. + +This repo's `AGENTS.md` follows suit: it widens ruling G16 and cites your +decision by its title. An informational intention tells updated repos. + +## Critical decisions + +- **The Architect writes down where to find the Mason.** At step 4 it puts + the id the Mason's harness resumes it by on the `**Plan:**` line. Without + it, "however long ago it closed" would fail without anyone noticing: the + id would live only in an Architect thread that compacts. The alternative + was to write nothing and treat any session the Architect cannot find as + lost. That costs nothing up front, but over time it quietly brings back + the fresh Mason you ruled out. +- **A fix of a comment runs the code review again** on the fix's diff, with + fresh reviewers. Step 6 already says "never skip, even for a small + retouch", and a looser rule after the human review would be a second rule + to remember. +- **The status stays `done`** while comments are fixed. As slice 01 + settled, the review is of a pull request, not a status. Sending the task + back to `in-progress` would reopen documents that are already archived. +- **The fix follows the same discipline as a review finding.** It goes + through a Typist unless it is a retouch of a few lines. Each comment is + written in the work document with its fix or its answer. The synthesis is + amended when a critical decision moves, so that the human's first reading + stays true. +- **A lost session is defined by its effect**, meaning the Architect cannot + resume it, not by any harness. The socle stays harness-neutral. + +## Data schema, before → after + +No data schema change. One task file gains a field: the work document's +`**Plan:**` line goes from "approved by , " to "approved by +, , and the id the Mason's harness resumes it by". The work +template itself is unchanged. + +## Architecture change + +None. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.work.md b/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.work.md new file mode 100644 index 0000000..647f26a --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.work.md @@ -0,0 +1,261 @@ +# 02 — Who fixes the comments — work + +Created by the Mason at the plan step, 2026-11-22. Spec: +`project-management/tasks/20261119-1644-relecture-humaine/02-who-fixes-the-comments.spec.md`. + +**Plan:** approved by the Architect, 2026-11-22, with these rulings on the +Mason's questions: (1a) step 4 writes the Mason's handle on the `**Plan:**` +line; (2a) `code-review` always runs again, fresh reviewers, on the fix's +diff; (3a) the status stays `done`; (4a) amend the Mason-reuse line of this +repo's `AGENTS.md` (outside the chisel markers), citing parent decision 11 — +the G16 entry of `review-360-decisions.md` is left to the human; (5) a +Typist on the mid tier. The three calls made without asking stand. +Mason handle: a922d3d1d9042bc18. + +## Program Design + +The rule of parent decision 11 (the Mason who did the work fixes the +comments): the task's Mason fixes the human review's comments, however long +ago it closed; a fresh Mason only when its session is lost; a comment that +changes a spec decision is written into the spec by the Architect first, +then the same Mason is woken. Today `workflow.md` contradicts it in two +places: the "Sub-agents" section says "a resumed task starts fresh", and +nothing says the Mason's session outlives step 7's "Stop everything". + +### Files touched + +| File | Change | +|---|---| +| `socle/agents/workflow.md` and `.agents/workflow.md` | Six edits, below. Both copies byte-identical (checked with `diff`). | +| `socle/intentions/unreleased/mason-fixes-the-comments.md` (new) | Informational intention. | +| `src/socle-files.ts` | The intention's line, sorted (before `review-section.md`). | +| `AGENTS.md` (this repo, outside the chisel markers) | The Mason-reuse line (ruling 4a), exact text below. | + +**The `AGENTS.md` line (ruling 4a).** In the bullet on the repo as memory, +the last sentence "Role reuse follows ruling G16: reviewers fresh, the +Mason (named the Crewmate in the record) reused within a live thread." +becomes: `Role reuse follows ruling G16, widened by decision 11 of the +human-review task (project-management/tasks/20261119-1644-relecture-humaine.spec.md): +reviewers fresh, the Mason (named the Crewmate in the record) kept for its +whole task, the human review's comments included; a fresh Mason only when +its session is lost.` + +Untouched: `CHARTER.md` (it already says "The fixes after a review belong +to the Mason that wrote the code"), `methodology.md` ("Re-runs and crashes" +stays true for a lost session), `reference.md`, the work and spec +templates, the tests (TESTS.md: no test pins the socle's prose; the +criteria are checked at review). `AGENTS.md` is a question below. + +### The six edits of workflow.md + +Exact text, so the Typist decides nothing. + +1. **The roles table, Mason row, "What it does" cell.** Append one + sentence: `Woken again after the close, it fixes the human review's + comments.` + +2. **Step 4 (Read the plan), the approval sentence.** It becomes: `the + approval is written on the work document's **Plan:** line, with who and + when, and the Mason's handle: the id its harness resumes it by.` + (Question 1 below; dropped if the Architect says no.) + +3. **Step 7 (Close), after the "Stop everything you started … stops the + work of others." sentence.** Add: `This does not end the Mason itself: + its session is kept, for step 8 wakes it to fix the comments.` + +4. **Step 8 (Human review), a new paragraph before "The review ends when + …".** + + > **Who fixes the comments.** A comment that asks for a change goes to + > the task's Mason, the one that planned, coded and closed it. The + > Architect wakes it in its own session, however long ago it closed: + > waking it costs as much as a fresh one, but it holds the whole + > context. A fresh Mason only when that session is lost; it starts from + > the spec, work and synthesis documents. A comment that changes a + > decision of the spec: the Architect writes the new decision into the + > spec first, then wakes the same Mason on it. The Mason fixes as it + > fixes a review finding: through a Typist unless the fix is a retouch + > of a few lines, the gate commands, `code-review` on the fix's diff, + > each comment written in the work document with its fix or its answer, + > the synthesis amended when a critical decision moved. It commits on + > the pull request's branch and reports to the Architect, who answers + > the comment in crit and waits again. The status stays `done`. + + The sentence on the status depends on question 3; the `code-review` + clause on question 2. + +5. **"Where the work stops", the Mason row, "When" cell.** It becomes: + `After the plan; after the close, with its report; after fixing the + human review's comments; on a blocker it cannot rule on`. + +6. **"Sub-agents", the last paragraph.** It becomes: + + > A brief is artifacts and paths, never the conversation: whatever the + > sub-agent needs must already be in the repo. Reviewers are always + > fresh. A Mason is kept for its whole task: the one that wrote the plan + > launches its Typist, runs the review, closes, and is woken to fix the + > human review's comments, however long after the close. A fresh Mason + > starts from the spec, work and synthesis documents only when that + > session is lost. + + And **"The Mason brief"**: the steps bullet ends `…; close; then, when + woken, the human review's comments`; the reports bullet adds `after the + comments, the commits and how each comment was fixed or answered`. + +### The intention + +`unreleased/mason-fixes-the-comments`, `informational`, the nine sections +in order, modelled on `unreleased/human-review-step`: + +- **Goal:** the human knows the task's Mason fixes the human review's + comments, and that its session is kept after the close. +- **Why:** waking the same Mason costs as much as a fresh one but carries + the whole context; a team that discards its Masons at the close, or + starts a fresh one on the comments, loses it. +- **Applies When:** the repo is updated from a version whose + `.agents/workflow.md` step 8 has no "Who fixes the comments" paragraph. +- **Do Not Apply When:** `Never: the copy chisel update makes carries the + change.` +- **Observable Gaps:** one, "What the human knows", done when read. +- **Out of Scope:** the project's own instructions outside the chisel + markers of `AGENTS.md` (a project that says otherwise reconciles itself). +- **Reference Paths:** `.agents/workflow.md` — copy. +- **Validation / Record Result:** as `human-review-step`. + +### Decisions the spec left open (my calls, unless the Architect rules) + +- **Where the comments are recorded:** in the work document, the same way + as the code-review findings, under a dated heading of its own. No + template change. +- **The synthesis is amended** when a fix moves a critical decision: it is + the human's first reading and must stay true. +- **A lost session** is named by its effect (the Architect cannot resume + it), not by a harness: the socle stays harness-neutral. + +### Order + +No test applies (no behaviour changes; the integrity test already lists +every socle file and will catch a missing `socle-files.ts` line). + +1. The six edits in `socle/agents/workflow.md`, copied to + `.agents/workflow.md`; `diff` shows nothing. +2. The intention and its `socle-files.ts` line. +3. `deno task check`, `deno task test`, + `deno task release-check gate origin/main`. One commit. + +### Questions for the Architect + +1. **How the Architect finds the Mason again after a compaction or a long + pause.** + - (a) Step 4 writes the Mason's handle on the `**Plan:**` line (edit 2). + - (b) Nothing written; whatever the Architect cannot resume counts as + lost. + - Recommendation: (a). "However long ago it closed" fails silently if + the handle lives only in a thread that compacts; one clause on a line + that already exists, no template change. +2. **Does `code-review` run again on the fix's diff?** + - (a) Yes, always, fresh reviewers on the fix's diff only. + - (b) Only when the fix is more than a retouch. + - Recommendation: (a). Step 6 already says "never skip this step, even + for a small retouch"; a different rule after the human review would + be a second rule to remember. +3. **The status while the comments are fixed.** + - (a) It stays `done`, said in one sentence of step 8. + - (b) It goes back to `in-progress`, and the Mason leaves `done` again. + - Recommendation: (a). Slice 01 settled that the review is of a pull + request, not a status; the documents are already archived. +4. **This repo's `AGENTS.md`** says "the Mason … reused within a live + thread" (ruling G16). Decision 11 widens it. + - (a) Amend that line in this slice: "reused for its whole task, the + human review's comments included (parent decision 11 of the + human-review task)". + - (b) Leave it; the Architect records the widening of G16 in + `review-360-decisions.md` itself. + - Recommendation: (a), one line, and a dated note under G16 is yours. +5. **Typist or retouch.** About twenty lines of prose in two mirrored + files, plus a fifty-line intention, all with exact text above. + Recommendation: a Typist (the default), since this is more than a few + lines. + +## Worklog + +- 2026-11-22: plan written. Read the slice and parent specs, slice 01's + work document and synthesis, `workflow.md` (both copies identical), + `CHARTER.md`, `methodology.md` (session and Typist sections), ruling G16 + in `review-360-decisions.md`, the intention template and + `unreleased/human-review-step`, `release-check.ts`'s gate. +- 2026-11-22 (Typist): typed the plan, no deviation. The six edits in + `socle/agents/workflow.md` (rulings 1a, 2a, 3a applied), copied to + `.agents/workflow.md` (`diff` empty); the intention + `mason-fixes-the-comments` and its `socle-files.ts` line; the `AGENTS.md` + line. Gates: `deno task check` ok (34 files), `deno task test` 77 passed + 0 failed, `deno task release-check gate origin/main` ok ("The socle + change adds an intention."). +- 2026-11-22 (Mason): `code-review` since 60a6da7; the fixes typed by the + Mason as a retouch of a few lines (workflow step 5 exception), see + Diff-Review Findings. Close: the spec's three criteria ticked, the + synthesis written beside the spec (frontier tier), journal entry 53, + `retro` run, status `done`. The files stay in the task folder and + archive with the parent when group A closes. + +## Implementation Checkboxes + +- [x] workflow.md: the six edits in `socle/agents/`, mirrored to `.agents/` +- [x] Intention `mason-fixes-the-comments`, listed in `socle-files.ts` +- [x] `AGENTS.md` Mason-reuse line (ruling 4a) +- [x] `deno task check`, `deno task test`, intention gate green + +## Notes & Snippets + +- The Intention gate compares the branch to `origin/main`; slice 01's + intentions already satisfy it, so it passes either way. The new + intention is written because the change deserves its own, not for the + gate. +- `deno fmt` does not cover `socle/` or `project-management/`. + +## Diff-Review Findings + +`code-review` since 60a6da7, 2026-11-22: two fresh reviewers, Standards and +Spec. The fixes are a Mason retouch of a few lines (workflow step 5 +exception), made after the Typist's hand-back. Gates green after them: +`deno task check` ok, `deno task test` 77 passed, the Intention gate ok. + +- **The `AGENTS.md` line cited "decision 11" and an unquoted path** + (Standards, writing rule of `discipline.md`). Fixed: the decision is + named by its title, the path is in backticks with its section, "The + decisions". +- **Step 7 said "for step 8 wakes it"** (both reviewers): a bare step + number, and step 8 is the Architect's. Fixed: "so that the Architect can + wake it at step 8, Human review, to fix the comments." +- **Lines patched in place, not reflowed** (both, judgement). Fixed: steps + 4 and 7, step 8's paragraph, the Sub-agents paragraph, the Mason brief + and the intention reflowed to the house width. Step 2's long line is + older than this slice and left alone. +- **The lost-session rule written twice in `workflow.md`** (Standards, + Duplicated Code). Fixed: the Sub-agents paragraph now says the Mason is + kept for its whole task and points at "Who fixes the comments" for when + a fresh one replaces it. Kept in `AGENTS.md` and the intention: one is + this repo's routing page, the other travels alone. +- **"Handle" is not a glossary term** (Standards, Mysterious Name). Fixed: + the workflow and the intention say "the id the Mason's harness resumes it + by". The Architect's `**Plan:**` line keeps its own word. +- **The documents are already archived when the comments come** (Spec). + Fixed: a fresh Mason starts from the documents "where step 7 archived + them"; the Architect and the Mason write in those same files. +- **The Statuses table says `in-progress` is "A Mason is … closing it", yet + a Mason now works under `done`** (Spec). Answered: step 8's sentence now + carries its reason, "the review is of a pull request, not a status" + (ruling 3a); the table lists what leaves each status, and fixing + comments leaves none. +- **The Mason's lifecycle touches seven places of one file** (Standards, + Shotgun Surgery). Answered: the roles table, the stops table and the + Mason brief are listings by design; after the dedup only step 8 states + the rule, and step 7 and Sub-agents point at it. +- **Step 4's id clause is a new duty the slice spec did not ask for** + (Spec). Answered: ruling 1a on the `**Plan:**` line; the synthesis names + it as a decision. +- **"Signal: none in the repo" read against the template's "a gap whose + signal is absent is already closed"** (Standards). Answered: the same + wording as `unreleased/human-review-step`; an informational intention's + gap is the human's knowledge, which the repo cannot show. A retro + proposal, not a fix here. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.spec.md b/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.spec.md new file mode 100644 index 0000000..22065e8 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.spec.md @@ -0,0 +1,72 @@ +# 03 — One shot + +**Status:** done — group A, approved by Pierrick on 22/11 (ffaf5ec); closed 22/11 +**Blocked by:** 01 — Human review with crit + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +**What to build:** a task can run in **one shot**, the lane first called +the autoroute. Pierrick (21/11): « En oneshot je n'interviens que pour la +review finale. Et encore. » In one shot there is no spec reading by the +human and no fixing round driven by him; the only human stop left is the +final review, and it may be skipped too. The Architect's one-shot line in +the spec says whether the final review happens. The code review, the gates +and the pull request still run. + +The merge: when the final review happens, Pierrick's approval there is his +word for the merge; when it is skipped, the merge follows the merge and +publish section of `project.md`, by default his explicit word (proposed, +parent spec decision 18). + +The Architect takes the one shot when it judges the task small at step 2, +or when the human asks for it explicitly. It writes the choice, its reason +and whether the final review happens in one line of the spec, and the pull +request repeats it. A human who asks for the full lane always gets it. +There is no project switch (ruling G10). + +Before the spec, step 2's interview is clarified: when the need is clear +the Architect does not interview (as `workflow.md` already says); when the +`grilling` interview gets tangled, it switches to the `wayfinder` skill, a +map of decision tickets. Parent spec: decisions 2, 14, 18, 19. + +## Acceptance criteria + +- [x] **autoroute-written** — `workflow.md` names the one shot, what it + skips (the spec reading, the stops of the full lane after it), what it + keeps (the code review, the gates, the pull request, the final review + when the spec line asks for it), and the two ways it is taken. +- [x] **autoroute-visible** — a task in one shot says so in its spec and in + its pull request, with whether the final review happens. +- [x] **stops-table-one-shot** — the "Where the work stops" table says + which stops the one shot removes, and how the merge goes with and + without the final review. +- [x] **wayfinder-named** — step 2 names `wayfinder` for an interview that + tangles, and keeps « no interview » for a clear need. +- [x] **intention-per-change** — the Intention gate passes. +- [x] **suite-green** — `deno task check` and `deno task test` pass. + +--- + +> 🧑 **REVIEW IF RELEVANT** — notes written before the work document exists. + +## Notes + +- The file keeps its name `03-autoroute` so links don't break; the text + says « one shot », Pierrick's word. +- Pierrick never reads the plan today (step 4 is the Architect's; a plan + that departs from his decisions goes to him), so the one shot has + nothing to remove there. +- A spec that carries decisions the task did not state still goes to the + human today (step 2). In one shot it does not: the one shot overrides + that stop, on Pierrick's « non » of 21/11. +- **Architect, 2026-11-22, at the plan reading (rulings in the work + document's `**Plan:**` line):** the second note above is superseded. In + one shot, a plan that departs from the human's decisions does not go to + him: the Architect rules, writes it on the `**Plan:**` line, and the + synthesis names it (ruling 2a, on « je n'interviens que pour la review + finale »). The merge paragraph's « proposed » is read as settled by + Pierrick's go of 22/11 on this spec (ruling 3a): approving the final + review is his word for the merge, said in so many words when the review + is handed. Flagged to him in the pull request; he may withdraw it there. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.synthesis.md b/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.synthesis.md new file mode 100644 index 0000000..90fdb02 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.synthesis.md @@ -0,0 +1,71 @@ +# Synthesis — One shot (slice 03) + +## What changed and why + +Every task went through every human stop of the workflow, however small it +was: you read the spec when it carried a decision of its own, you were +asked about a plan that departed from your decisions, and you read the pull +request at the end. Your words were « En oneshot je n'interviens que pour +la review finale. Et encore. » `workflow.md` now has a section, **The one +shot**, that gives a task exactly that lane. + +The Architect takes the one shot when it writes the spec, if it judges the +task small or if you ask for it. It writes one line in the spec, under the +status line: + + **One shot:** ; final review kept + +or `final review skipped`. The pull request description opens with the +same line, copied as is, so you see the lane before anything else. A human +who asks for the full lane always gets it, and no project setting switches +the one shot on: the lane is chosen task by task, as ruling G10 asked. + +What it removes: your reading of the spec, and your ruling on a plan that +departs from your decisions. What it keeps: the plan and the Architect's +reading of it, the Typist, the code review with its fresh reviewers, the +gates, the close and its synthesis, the pull request, and the final review +when the line keeps it. The "Where the work stops" table gains an "In one +shot" column that says this stop by stop. Step 2 also names the `wayfinder` +skill for a spec interview that tangles, and keeps "no interview" for a +clear need. + +## Critical decisions + +- **"One-shot" no longer means a quick fix.** The old glossary called work + done without a task artifact "one-shot". That meaning is now **quick + fix**, in `reference.md`, `discipline.md`, `methodology.md` and + `PHILOSOPHY.md`, so that one word does not name two things. The + alternative was to call the lane something else, but « one shot » is your + word. A project whose own instructions still say "one-shot" in the old + sense must reconcile them itself; the intention says so. +- **In one shot, the Architect rules on a plan that departs from your + decisions.** It writes the ruling on the work document's `**Plan:**` line, + and the synthesis names it among the critical decisions, so you find it in + your first reading if there is one. The alternative was to keep that stop, + but then the one shot would no longer hold to "only the final review". + This contradicts a Note in the spec ("nothing to remove there"), which sits + in a 🧑 zone and is left to the Architect to amend. +- **Approving the final review is your word for the merge.** The Architect + says so in so many words when it hands you the review, so the approval is + never inferred. Without a final review, the merge follows the merge and + publish section of `project.md`, by default your explicit word. Discipline + rule 9 is unchanged: the word is still explicit, it is just given in the + review. +- **The decisions in a one-shot spec belong to the Architect.** The + zone-ownership rule and discipline rule 3 now say that a 🧑 zone belongs to + whoever approved it, and in one shot that is the Architect, even when the + spec carries decisions of its own. +- **No template change.** The `**One shot:**` line is described in + `workflow.md` only. Adding it to the spec template would put it in front of + every task, most of which run in the full lane. + +## Data schema, before → after + +No data schema change. A spec in one shot gains one line, `**One shot:** +; final review kept|skipped`, under `**Status:**`, or under `**Review +depth:**` when the spec has one. The pull request description opens with +it. + +## Architecture change + +None. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.work.md b/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.work.md new file mode 100644 index 0000000..c576c61 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.work.md @@ -0,0 +1,501 @@ +# 03 — One shot — work + +Created by the Mason at the plan step, 2026-11-22. Spec: +`project-management/tasks/20261119-1644-relecture-humaine/03-autoroute.spec.md`. + +**Plan:** approved by the Architect, 2026-11-22, with these rulings on the +Mason's questions: (1a) the lane is « One shot », Pierrick's word; the old +meaning (work without a task artifact) becomes « quick fix » in +`reference.md`, `discipline.md`, `methodology.md` and `PHILOSOPHY.md`, both +copies where one exists; flagged to the human in the PR report. (2a) in one +shot the Architect rules on a plan that departs from the human's decisions, +writes it on the `**Plan:**` line, and the synthesis names it. (3a) when the +Architect hands the final review, it says in so many words that approving +it is the word for the merge; discipline rule 9 is untouched. (4a) no +template change. (5) a Typist on the mid tier, not cheap: four mirrored +files and a table. The four calls made without asking stand. +Mason handle: aea639ed84342cb55. + +## Program Design + +The lane of parent decisions *The one shot* and *When the autoroute is +taken*, and the clarified interview of *Clarifying only when needed*. A task +in one shot has no spec reading by the human and no stop for a human +reading after it; the final review is the only human stop left, and the +spec's one-shot line says whether it happens. The code review, the gates, +the close and the pull request run as in the full lane. No project switch +(ruling G10, the switch "Autonomous runs" removed: the lane is the +launcher's choice, task by task). + +Found while reading, and shaping the plan: + +- **`wayfinder` exists**: `socle/agents/skills/wayfinder/SKILL.md`, copied + in `.agents/skills/wayfinder/`, already named by the side lanes of + `discipline.md`. It is user-invoked (`disable-model-invocation: true`), + like `slice-task`, which step 2 already names as the Architect's tool; + the Architect reads and follows the file. No skill change. +- **The word "One-shot" is taken.** The glossary of `reference.md` defines + it as "work done without a task artifact", and `discipline.md` uses it + three times in that sense ("a one-shot fix", "one-shot work"), as does + one line of `methodology.md`. The new lane has a spec. Question 1. +- **Two rules make the human approve a spec with new decisions**: step 2 + of `workflow.md` and "Zone ownership" of `reference.md`, which rule 3 of + `discipline.md` repeats. The one shot overrides that stop (slice spec + Notes), so all three say so. +- **The merge rule against discipline rule 9** ("never inferred from a + 'go' given on another subject"). An approval of the final review counts + as the word for the merge only if the human knows it when he approves; + so the Architect says it when it hands the review. Question 3. + +### Files touched + +| File | Change | +|---|---| +| `socle/agents/workflow.md` and `.agents/workflow.md` | Step 2, a new section "The one shot", "After the close", the stops table. Edits 1 to 4 below. | +| `socle/agents/reference.md` and `.agents/reference.md` | Glossary: the old term renamed, the new one added; one sentence in "Zone ownership". Edits 5 and 6. | +| `socle/agents/discipline.md` and `.agents/discipline.md` | Rule 3's parenthesis; the three "one-shot" of the old sense. Edit 7. | +| `socle/agents/methodology.md` and `.agents/methodology.md` | One word of the old sense. Edit 8. | +| `PHILOSOPHY.md` (this repo only, no socle copy) | One word of the old sense (ruling 1a). Edit 10. | +| `socle/intentions/unreleased/one-shot.md` (new) | Informational intention. Edit 9. | +| `src/socle-files.ts` | `"intentions/unreleased/one-shot.md",` after the `mason-fixes-the-comments.md` line. | + +Each socle file and its `.agents/` copy end byte-identical: check with +`cmp`. Untouched: the spec and work templates (question 4), `CHARTER.md`, +`AGENTS.md`, every skill, the tests (no test pins the socle's prose; the +integrity test catches a missing `socle-files.ts` line). + +### The spec's one-shot line + +Written by the Architect at step 2, directly under the `**Status:**` line +(under `**Review depth:**` when the spec has one): + + **One shot:** ; final review kept + +``: the task is small, or the human asked for it; or the same line +ending in `final review skipped`. When it is kept, the review +runs at the spec's depth as step 8 says. The pull request's description +opens with the line, copied as is. + +### Writing rules for the Typist + +Copy the text below exactly. Prose lines are 80 columns at most; every +paragraph touched is reflowed, and the blocks below already are. Shipped +text names a decision by its title, never by its number. + +### Edit 1 — `workflow.md`, step 2 + +Replace the whole paragraph "**2. Write or sharpen the spec — Architect.** +… Status: `draft`, then `ready`." with: + +```markdown +**2. Write or sharpen the spec — Architect.** When the task arrives clear — +a well-written issue, a clear request — write the spec document from it, +with no interview: from the spec template declared in `.agents/project.md`, +named with the task id script, short, linking the issue rather than copying +it. When the intent is unclear, interview the human first with the +`grilling` skill, one question at a time, a recommended answer with each, +with `domain-modeling` underneath: new domain terms land in the glossary +and hard-to-reverse decisions in an ADR, where the glossary and decisions +section of `.agents/project.md` puts them. When the interview tangles — +each answer opens more questions than it settles — switch to the +`wayfinder` skill: a map of decision tickets, resolved one at a time, whose +destination is the spec. Either way the seams are named, and the sizing +check is said out loud: the task fits one pass, or it is cut into slices +with the `slice-task` skill. The spec carries a `**Review depth:**` line, +`full` or `strategic`, when the task departs from the default of §J · +Review of `.agents/project.md`, and a `**One shot:**` line when the +Architect takes the one shot ("The one shot", below). The human approves +the spec when it carries decisions the task did not state, except in one +shot; otherwise the Architect moves it to `ready` itself. Commit the spec. +Status: `draft`, then `ready`. +``` + +### Edit 2 — `workflow.md`, the "After the close" paragraph + +Replace the paragraph "**After the close — Architect.** … the only go." +with: + +```markdown +**After the close — Architect.** Read the close report and rule on anything +left. Open the pull request; in one shot, its description opens with the +spec's `**One shot:**` line, copied as is. Run the human review (step 8) on +it, unless that line skips the final review. Once the review is done or +skipped, merge and publish as the merge and publish section of +`.agents/project.md` says; by default, ask the human, whose explicit word +on that very action is the only go. In one shot with the final review, the +Architect says in so many words, as it hands the review, that approving it +is the word for the merge; the approval is then that word. +``` + +### Edit 3 — `workflow.md`, a new section "The one shot" + +Insert after the last paragraph of "The steps" ("The review ends when … +follows `.agents/project.md`.") and before "## Where the work stops": + +```markdown +## The one shot + +A task can run in **one shot**: the human's only possible stop is the final +review, and the spec says whether it happens. The Architect takes the one +shot at step 2 when it judges the task small, or when the human asks for +it. A human who asks for the full lane always gets it. There is no project +switch: the lane is chosen task by task. + +The Architect writes the choice in one line of the spec, directly under its +`**Status:**` line, or under `**Review depth:**` when the spec has one: + + **One shot:** ; final review kept + +`` is the reason: the task is small, or the human asked for it. The +line ends in `final review skipped` when there is no final review. The +pull request repeats it. + +What the one shot skips: the human's reading of the spec, which the +Architect approves itself even when it carries decisions the task did not +state, and every stop that only serves a human reading after it; "Where the +work stops" says which. What it keeps: the plan and the Architect's reading +of it, the Typist, the code review and its fresh reviewers, the gate +commands, the close and its synthesis, and the pull request. When the line +keeps the final review, it runs as step 8 says, at the spec's depth. A plan +that departs from the task's own decisions is the Architect's to rule on: +it writes the ruling on the `**Plan:**` line, and the synthesis names it +among the critical decisions. +``` + +### Edit 4 — `workflow.md`, the "Where the work stops" table + +Replace the table (header, separator and five rows) with: + +```markdown +| Who stops | For whom | When | In one shot | +|---|---|---|---| +| Mason | Architect | After the plan; after the close, with its report; after fixing the human review's comments; on a blocker it cannot rule on | Kept | +| Typist | Mason | After its part of the plan; on anything the plan does not answer | Kept | +| Architect | Human | On an unclear intent | Kept: the intent is settled before the lane is chosen | +| Architect | Human | On a spec that carries decisions the task did not state | Removed: the Architect approves the spec | +| Architect | Human | On a plan that departs from the human's decisions | Removed: the Architect rules, and the synthesis says so | +| Architect | Human | On a blocker above what it owns | Kept | +| Architect | Human | At the human review, waiting for the human's reading of the pull request | Only when the spec's one-shot line keeps the final review | +| Architect | Human | Before a merge or a publish, unless the project lets the agent do it | With the final review, its approval is the word for the merge; without it, kept | +``` + +The two sentences under the table stay as they are. + +### Edit 5 — `reference.md`, the glossary + +Replace the row `| **One-shot** | Work done without a task artifact. … +skipped. |` with these two rows, in this order: + +```markdown +| **Quick fix** | Work done without a task artifact. The discipline still applies; only the file bookkeeping is skipped. | +| **One shot** | A task whose only possible human stop is the final review, and that one only when its spec's `**One shot:**` line keeps it ("The one shot" in `.agents/workflow.md`). | +``` + +### Edit 6 — `reference.md`, "Zone ownership" + +Replace the paragraph with: + +```markdown +A 🧑 zone belongs to whoever **approved** it. The human approves a spec that +carries decisions the task did not state; the Architect approves one written +from a clear task, and then the zones carry the task's own decisions, which +are the human's. In one shot the Architect approves the spec even when it +carries decisions of its own, and those decisions are then its own. The +work document has no zone: it belongs to the Mason that wrote it. A 🧑 zone +is never overridden silently — a conflict with one is surfaced, never +edited sideways. +``` + +### Edit 7 — `discipline.md` + +- Opening paragraph: "A one-shot fix runs under the same discipline as a + sliced feature" becomes "A quick fix runs under the same discipline as a + sliced feature". Reflow: + + ```markdown + These rules apply to **every** conversation in this repo, with or without a + task artifact. A quick fix runs under the same discipline as a sliced + feature; the only difference is the paperwork. + ``` + +- Rule 2, first sentence: "Even for a one-shot fix:" becomes "Even for a + quick fix:". The line stays under 80 columns; nothing else moves. + +- Rule 3 becomes: + + ```markdown + 3. **🧑 zones are law.** Sections marked 🧑 in a spec document carry the + decisions of whoever approved them — the human, unless the Architect + approved the spec ("Zone ownership" in `.agents/reference.md`). Never + contradict one silently: if the work reveals a conflict with a 🧑 zone, + stop and surface it. + ``` + +- Rule 5, first sentence: "No task artifact for casual conversation or + one-shot work." becomes "No task artifact for casual conversation or a + quick fix." Reflow: + + ```markdown + 5. **The bridge rule.** No task artifact for casual conversation or a + quick fix. But when a conversation turns into real, scoped, multi-step + work, recognize it and PROPOSE a task under `.agents/workflow.md` — + inform, never force. Formality is opt-in; detection is not. Most work + should stay small: if everything becomes a big feature, review gets + diluted and the method has failed. + ``` + +### Edit 8 — `methodology.md` + +In the bullet "Real-world distribution (dex): ~40% of work is one-shot, +medium work gets a single spec/work pair, only large work gets the full +breakdown.", "one-shot" becomes "a quick fix". Reflow: + +```markdown +- Real-world distribution (dex): ~40% of work is a quick fix, medium work + gets a single spec/work pair, only large work gets the full breakdown. +``` + +### Edit 10 — `PHILOSOPHY.md` (ruling 1a) + +In the bullet "**Ambient by default, ceremony on demand.**", the last +sentence "The one-shot fix stays cheap." becomes "The quick fix stays +cheap." Nothing else moves. + +### Edit 9 — the intention `socle/intentions/unreleased/one-shot.md` + +```markdown +--- +id: unreleased/one-shot +classification: informational +--- + +# A task can run in one shot + +## Goal + +The human knows that a task can run in one shot, with the final review as +its only possible human stop, and that the word "one-shot" of the old +glossary is now "quick fix". + +## Why + +Small tasks went through every human stop of the workflow, the spec +reading first. The one shot lets the Architect take a small task, or one +the human asks for, from the spec to the pull request with no stop but +the final review, and that one only when the spec keeps it. The code +review, the gates and the pull request still run. A team that does not +know it keeps reading specs it did not need to read, and reads "one-shot" +in the old sense where the workflow now means the lane. + +## Applies When + +- The repo is updated from a version whose `.agents/workflow.md` has no + section "The one shot". + +## Do Not Apply When + +- Never: there is nothing to apply. `workflow.md`, `reference.md`, + `discipline.md` and `methodology.md` are managed files and the copy + `chisel update` makes carries the change; the session only reads it to + the human. + +## Observable Gaps + +1. **What the human knows.** Signal: none in the repo. Say it to the + human in a few sentences: the Architect takes the one shot at step 2 + when it judges the task small, or when the human asks, and writes a + `**One shot:**` line in the spec, with its reason and whether the final + review is kept or skipped; the pull request repeats it; a human who + asks for the full lane always gets it, and no project setting switches + it on. With the final review, approving it is the word for the merge, + and the Architect says so when it hands the review; without it, the + merge goes as the glue's merge and publish section says. Step 2 now + switches from `grilling` to `wayfinder` when the interview tangles. + Work done without a task artifact is now called a quick fix. + Done when: the human has read it. + +## Out of Scope + +- The project's own instructions outside the chisel markers of + `AGENTS.md`, which may still say "one-shot" in the old sense: a project + that does reconciles itself. + +## Reference Paths + +- `.agents/workflow.md` — **copy**, by the update. +- `.agents/reference.md` — **copy**, by the update. +- `.agents/discipline.md` — **copy**, by the update. +- `.agents/methodology.md` — **copy**, by the update. + +## Validation + +- Nothing to check in the repo: the closing update carries the change. + +## Record Result + +The closing `chisel update` records it, with the other informational +intentions. +``` + +### Decisions the spec left open (my calls, unless the Architect rules) + +- **The line's place and form**: under `**Status:**` (or `**Review + depth:**`), one line, reason then `final review kept | skipped`; the PR + description opens with it, copied as is. One form, so it can be found + with a grep. +- **The synthesis is still written in one shot**: it is part of the close, + not a human stop, and it is the record the pull request carries even + when the final review is skipped. +- **The blocker stop is kept in one shot**: parent decision *When the + autoroute is taken* skips "the stops that only serve the human"; a + blocker above what the Architect owns is not a reading, and discipline + rule 6 forbids forcing it. +- **The unclear-intent stop is kept**: the slice spec skips "the stops of + the full lane after" the spec reading; the interview comes before the + lane is chosen. +- **`wayfinder` is named "switch to"**, like `slice-task`, though both are + user-invoked: the Architect reads and follows the skill file. The flag + stays. + +### Order + +No test applies (no behaviour changes; TESTS.md has no prose tests; the +integrity test catches a socle file missing from `socle-files.ts`). + +1. Edits 1 to 4 in `socle/agents/workflow.md`, copied to + `.agents/workflow.md`; `cmp` silent. +2. Edits 5 to 8 in `socle/agents/`, copied to `.agents/`; `cmp` silent on + each pair. Edit 10 in `PHILOSOPHY.md`. +3. The intention and its `socle-files.ts` line. +4. `deno task check`, `deno task test`, + `deno task release-check gate origin/main`. One commit. + +### Questions for the Architect + +1. **The word "one-shot" already means work with no task artifact** (the + glossary of `reference.md`, three uses in `discipline.md`, one in + `methodology.md`); the new lane has a spec. + - (a) Rename the old term "quick fix" in those four places and give + "One shot" to the lane (edits 5, 7, 8 as written). + - (b) Keep the old term; name the lane "one-shot lane" in the glossary + and the text. + - (c) Keep both under one word, the glossary telling them apart. + - Recommendation: (a). Pierrick named the lane; (b) and (c) leave two + meanings one hyphen apart in the ambient core. It renames a term of + the ambient core, so it may be the human's to say. +2. **The stop "a plan that departs from the human's decisions" in one + shot.** + - (a) Removed: the Architect rules, writes it on the `**Plan:**` line, + and the synthesis names it (edits 3 and 4 as written). + - (b) Kept: it goes to the human even in one shot. + - Recommendation: (a). Pierrick: « En oneshot je n'interviens que pour + la review finale. Et encore. »; and parent decision *When the + autoroute is taken* lists reading the plan among the skipped stops. + In one shot the human made no decision beyond the task itself. +3. **The merge with the final review** (the slice spec, approved on 22/11, + still marks it "proposed", after parent decision *The one shot*), read + against discipline rule 9. + - (a) As written: the Architect says, as it hands the review, that + approving it is the word for the merge; rule 9 is untouched, since the + human then gives his word knowing what it covers. + - (b) Keep the merge question separate even after the final review. + - Recommendation: (a), if the approval on 22/11 settled the "proposed". +4. **The spec template.** + - (a) No change: the line's form lives once, in "The one shot" of + `workflow.md`, and most specs run the full lane. + - (b) A `**One shot:**` line in the template's header, deleted for the + full lane, as `**Review depth:**` is. + - Recommendation: (a). A line to delete in nearly every spec is noise, + and the Architect who takes the one shot is reading the workflow. +5. **Typist or retouch.** About sixty lines of prose across four mirrored + files, a table and a sixty-line intention, all with exact text above. + Recommendation: a Typist on the cheap tier (the plan is mechanical). + +## Worklog + +- 2026-11-22: plan written. Read `CHARTER.md`, `discipline.md`, + `workflow.md`, the slice and parent specs, slice 02's work document and + synthesis, ruling G10 in `review-360-decisions.md`, `reference.md` + (glossary, zone ownership), the spec and work templates, the intention + template and the unreleased intentions, the `wayfinder` skill. + +- 2026-11-22, Typist: typed the plan as written. Edits 1 to 4 in + `socle/agents/workflow.md`; edits 5 to 8 in `reference.md`, + `discipline.md`, `methodology.md`; edit 10 in `PHILOSOPHY.md`; the + intention `one-shot.md` and its `src/socle-files.ts` line. The `.agents/` + copies were byte-identical to the socle files before the edits, so each + was made by copying the edited socle file; `cmp` silent on the four + pairs. Deviation: none. Note: in `discipline.md` rule 3 the text in the + repo differed from the plan's "before" (it spoke of a spec "that carried + no new decision"); replaced by the plan's new text as given. Gates: + `deno task check` exit 0; `deno task test` 77 passed, 0 failed; + `deno task release-check gate origin/main` exit 0 ("The socle change adds + an intention."). + +- 2026-11-22: `code-review` from 45fd8c1; ten findings fixed by a retouch, + six answered (Diff-Review Findings). `cmp` silent on the four pairs; + `deno task check` exit 0; `deno task test` 77 passed; Intention gate + exit 0. + +## Implementation Checkboxes + +- [x] workflow.md: edits 1 to 4, in `socle/agents/` and `.agents/` +- [x] reference.md, discipline.md, methodology.md: edits 5 to 8, mirrored; + PHILOSOPHY.md: edit 10 +- [x] Intention `one-shot`, listed in `socle-files.ts` +- [x] `deno task check`, `deno task test`, Intention gate green + +## Notes & Snippets + +- The Intention gate compares the branch to `origin/main`; slices 01 and + 02 already satisfy it. The new intention is written because the change + deserves its own. + +## Diff-Review Findings + +`code-review` on the diff from 45fd8c1 (the Typist's commit), Standards +and Spec side by side. Fixed by a Mason retouch, in the socle files and +their `.agents/` copies: + +- **Glossary "One shot" named a task, the workflow a lane.** The row now + defines the lane, and says the other one is the full lane. +- **"one-shot line" hyphenated in the stops table.** Now the + `**One shot:**` line, in backticks. +- **Rule 3 lost the case of a spec with no new decision.** The Typist + replaced the rule's text with the plan's, which had missed it. The rule + now names both cases in which the Architect approved, and points at + "Zone ownership" in `reference.md`. +- **The roles paragraph and the plan step had no one-shot exception.** A + question still goes to the human "except in one shot", in both. +- **"The task's own decisions" against "the human's decisions".** The + one-shot section now says "the human's decisions", as the Architect's + ruling on departures from them does. +- **Step 2's "otherwise" was ambiguous.** Rewritten: the human approves a + spec with new decisions unless the task runs in one shot; in every other + case the Architect moves it to `ready`. +- **The final step's merge sentence ignored the one shot.** It now points + at "After the close", which holds both cases. +- **The Mason row said "Kept" even with no final review.** Now "Kept; no + comments to fix when the final review is skipped". +- **The side lanes and the workflow named different `wayfinder` + triggers.** The side lanes row now adds "a spec interview that tangles". +- **The intention cited bare step numbers.** Now it says what happens: + the Architect takes the one shot when it writes the spec. + +Answered, not fixed: + +- **The same rule told in several places.** The stops table, the one-shot + section, step 2 and "After the close" each list what applies where they + are read; the table is a summary by design, and the actions live in the + steps. +- **"step 2" inside `workflow.md`.** The house convention: a step is cited + by its name within the file that numbers it; every new mention names the + step. +- **Scope creep: the quick-fix rename and rule 9.** Covered by rulings 1a + and 3a on the `**Plan:**` line. +- **The spec's Note says "nothing to remove there", ruling 2a removes a + stop.** The Note sits in a 🧑 zone, which the Mason does not edit: left + to the Architect to amend. +- **The merge rule still "proposed" in the spec.** Ruling 3a settled it; + same 🧑 zone, same answer. +- **No `**One shot:**` line in the spec template.** Ruling 4a. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.spec.md b/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.spec.md new file mode 100644 index 0000000..445a1d9 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.spec.md @@ -0,0 +1,98 @@ +# 04 — Visual proof + +**Status:** done — group A, approved by Pierrick on 22/11 (ffaf5ec); closed 22/11 +**Blocked by:** 01 — Human review with crit + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +**What to build:** when a task touches a screen, the agent checks it itself +(a recorded Playwright e2e test, or at least a browser or Playwright check) +and the human review shows at least a screenshot of it, with a before → +after comparison when the screen existed. + +Two pieces, inside Chisel, with no Harness command (decision 16): + +- **A capture command**, the equivalent of the Harness's `captures.ts`: + Playwright captures written to disk, at the widths asked; a before → + after comparison at the pixel, with a `.diff.png` map and a verdict per + screen (identical, changed, new, size); and a text report: overflow, + console errors, off-site requests, content below the fold. Playwright + comes from the project. Pierrick (21/11): `captures.ts` is copied, in + Node, not rewritten. Olympe agreed (21/11, 23:55): « d'accord pour la + copie dans lonestone/chisel, sous sa licence. Prends la version du vault + à a05b1092 (la dernière, avec --clic, --sombre et le navigateur + distant). Trois choses propres à nos machines à retirer ou rendre + génériques : la recherche de playwright-core dans ~/projects/* (l. 71), + le nom HARNESS_PLAYWRIGHT_WS (renomme-le pour Chisel), et le texte + « harness captures » des messages et de l'usage. Aucun secret ni chemin + du vault dedans. Une copie, pas un lien : les deux vivront séparément, + je ne reporterai pas nos changements chez toi. » +- **A `visual-proof` skill**, made generic from music-downloader's + `review-videos`, that carries the method of the Harness's + `verification-visuelle`: mechanical first, through the capture command, + whose text often suffices; an agent never reads a capture in its own + thread; when looking is needed, a fresh sub-agent gets the paths, the + report, the precise question and the list of what it must find, reports + per capture, and says « not verified » for what it cannot see, never + « absent ». The human sees the images himself. + +The project declares in §J its e2e, recording and screenshot commands, each +optional, and where the proofs go. The depth is the Architect's line in the +spec; the diff only adds a floor (a screen touched means captures). The +proofs are the second of the three readings of the human review (slice 01); +until group B's tool shows them in a page, they are files in the folder §J +names, linked from the review. The close records the depth chosen and the +floor the diff computed, and `retro` compares them, so an agent that always +asks more than the floor shows. Parent spec: decisions 5, 10, 13, 16, 17, +24. + +## Acceptance criteria + +- [x] **visual-proof-skill** — the skill exists, reads its commands from + §J, names no command of one project, and says an agent never reads a + capture in its own thread. +- [x] **capture-tool** — the capture command ships with Chisel, is listed + in `src/socle-files.ts`, and on a page captured twice produces the + captures, a `.diff.png` for a changed screen and a text report. +- [x] **capture-copy-generic** — the copy carries none of the three + machine-specific things Olympe named: no search for `playwright-core` in + `~/projects/*`, no `HARNESS_PLAYWRIGHT_WS` (renamed for Chisel), no + « harness captures » in its messages or usage; and no vault path. +- [x] **review-section-commands** — §J declares the e2e, recording and + screenshot commands, each optional. +- [x] **spec-line-read** — the skill reads the depth line of the spec and + adds captures when the diff touches a screen the line left out. +- [x] **depth-against-floor** — the work-document template records the + depth chosen and the floor computed, and `retro` compares them. +- [x] **no-screen-no-capture** — a dry run on a repo with no front touched + produces no capture. +- [x] **intention-per-change** — the Intention gate passes. +- [x] **suite-green** — `deno task check` and `deno task test` pass. + +--- + +> 🧑 **REVIEW IF RELEVANT** — notes written before the work document exists. + +## Notes + +- Dry run on music-downloader before shipping (screens, e2e, recording). +- Sources: Harness `scripts/captures.ts` (245 lines, Node, Playwright) and + `skills/verification-visuelle/SKILL.md`. Why the method exists: on 02/11 + a crewmate read 22 PNGs (about 10 MB) in its own thread, for about $10. +- The copy is taken from the vault at commit a05b1092, under Chisel's + licence. It is a copy, not a link: Olympe will not carry the Harness's + later changes over, and Chisel owns its copy from then on. +- The socle ships only shell scripts today, so a Node script under + `socle/scripts/` is a first. +- **Architect, 2026-11-22, at the close:** `review-videos` is nowhere in + this repo's history and music-downloader has no checkout on this + machine. The skill was built from `verification-visuelle` and this spec; + the dry run was replaced by the fixture browser test (run for real + against a local `playwright-core`) and this slice's own close, which has + no screen and took no capture. The music-downloader dry run stays open, + for the human. +- **Archive:** the four slices of group A stay in the task folder until the + parent closes with group B; that corrects the slice 01 close ruling, + which said « when the last slice of group A closes ». diff --git a/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.synthesis.md b/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.synthesis.md new file mode 100644 index 0000000..0c1abe5 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.synthesis.md @@ -0,0 +1,79 @@ +# Synthesis — Visual proof (slice 04) + +## What changed and why + +Until now, a task that touched a screen reached your review with no image +of it: the agent might have opened a browser, or might not have, and you +read the diff of a stylesheet blind. This slice gives Chisel the second +reading of the human review. When the diff touches a screen, the agent +checks it itself and the review links captures, before and after when the +screen already existed. + +Two pieces ship in the socle. The **capture command**, +`node .agents/skills/visual-proof/scripts/captures.ts`, is the Harness's +`captures.ts` copied as is, with Olympe's agreement, at vault commit +a05b1092. It writes the captures to disk at the widths asked, compares +before and after at the pixel with a `.diff.png` and a verdict per screen, +and returns a text report: overflow, console errors, off-site requests, +content below the fold. Playwright comes from the project. The +**`visual-proof` skill** carries the method of `verification-visuelle`: +mechanical first, through that report; an agent never reads a capture in +its own thread; when an image must be looked at, a fresh sub-agent gets the +paths, the report and a precise question, and says « not verified » for +what it cannot see. You look at the images yourself. + +§J · Review gains the E2E, Recording and Screenshot commands, each +optional, and the proofs folder. `chisel-setup` asks for them. The spec +template's `**Review depth:**` line can now ask for proofs +(`strategic + captures`), and the diff adds a floor: a screen touched means +captures, even when the line left them out. The work document's new +`**Depth:**` line records the depth chosen and the floor at the close, and +`retro` compares them, so an agent that always asks more than the floor +shows. + +## Critical decisions + +- **The script lives inside the skill folder**, not in a new + `scripts/` at the root. `update` writes everything under `.agents/`, so + every repo already equipped receives it with no installer change. A + root `scripts/captures.ts` would have reached fresh installs only. It is + the first Node file in the socle; Deno never compiles it, and the tests + run it with `node` as a subprocess. +- **A copy, not a rewrite, and the French stays.** You asked for the copy. + It carries Olympe's three changes (no search in `~/projects/*`, + `CHISEL_PLAYWRIGHT_WS`, no « harness captures »), an MIT header with the + attribution, and the review's retouch that removed the private names and + topics from its comments. Translating or refactoring it would have made a + second program to maintain for no change in behaviour. +- **The floor is judged from the diff, not matched on paths.** The skill + says what touching a screen means (a page, a component, a stylesheet, a + template, a displayed string, an image, a font); the Mason judges. Path + patterns would differ in every stack. +- **The proofs are committed files**, in a `.proofs/` folder beside + the spec, until group B's page shows them. Since PNGs weigh in git, the + skill captures only the screens and widths the floor asks. +- **A Screenshot command left at none means no captures**, even though + Chisel ships one. The project chooses; the review says the proof is + missing. +- **The music-downloader dry run has not happened.** No checkout exists on + this machine, so the slice was built from the Harness's skill, not from + `review-videos`, which is in no history here. The no-screen dry run is + this slice's own close: no screen touched, no capture taken. The browser + test ran for real against a `playwright-core` on this machine. The dry + run on a repo with screens is left open for you. + +## Data schema, before → after + +No data schema change. Before, §J held one line, `**Default depth:**`. +After, it also holds `**E2E command:**`, `**Recording command:**`, +`**Screenshot command:**` (each `_(none …)_` by default) and +`**Proofs folder:**`. The spec's `**Review depth:**` line accepts +`[+ captures] [+ recording] [+ e2e]`, and the work document gains a +`**Depth:**` line. The migration intention `unreleased/review-proofs` +adds the §J lines to updated repos. + +## Architecture change + +The socle ships its first Node script, run from the project's root with the +project's own Playwright and Node 24.2 or later. Nothing in Chisel's own +code calls it. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.work.md b/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.work.md new file mode 100644 index 0000000..88355bc --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.work.md @@ -0,0 +1,1202 @@ +# 04 — Visual proof — work + +Created by the Mason at the plan step, 2026-11-22. Spec: +`project-management/tasks/20261119-1644-relecture-humaine/04-visual-proof.spec.md`. + +**Plan:** approved by the Architect, 2026-11-22, with these rulings on the +Mason's questions: (1a) the script lives in the skill folder; (2a) the copy +as described — Olympe's three changes, the MIT header (the licence +`deno.json` declares), the rewritten comment, `visual-proof`, `node +captures.ts`; the French stays, no translation; the skill says in one line +that a project whose linter reaches `.agents/` excludes the script; (3a) one +`**Review depth:**` line; (4a) a committed `.proofs/` folder beside +the spec, as §J's default — the skill keeps captures to the screens and +widths the floor asks, since PNGs weigh in git; (5a) the fixture browser +test and this slice's own close; music-downloader's dry run stays an open +item, flagged to the human; (6a) no command, no captures; (7) Typist on the +mid tier. The finding on `review-videos` is accepted. +Mason handle: aa450428155af1d37. + +**Depth:** chosen `full`, §J's default, since the spec has no `**Review +depth:**` line; floor none, no screen touched (this repo has no front, and +the diff changes the socle's prose, its install lists and a script, never a +page). At the floor: no capture taken and no `04-visual-proof.proofs/` +folder created. This is the no-screen-no-capture dry run. + +## Program Design + +This slice carries these parent decisions: + +- *A touched screen has a proof* (5); +- *Visual proof as a Chisel skill* (10); +- *The depth is a line of the spec, the diff a floor* (13); +- *Chisel serves its own pages* (16); +- *The proofs live in Chisel's pages* (17): until that page exists, the + proofs are files; +- *The visual proof starts from the Harness's method* (24). The Architect's ruling stands: the close record of decision 13 +belongs here. The work template gets a `**Depth:**` line, step 7 asks for +it, and `retro` compares the depth with the floor. + +What I found while reading: + +- **`review-videos` is not in this repo.** It is not in any commit. Only + the test fixture names of fee75e0 and b20f3bb mention it, and there is + no music-downloader checkout on this machine. So the skill is built from + the Harness's `verification-visuelle` (read at the vault, read-only) and + from the spec. +- **The source script runs as is.** I took a scratch copy of + `captures.ts` at a05b1092 and ran it under Node 24.13.0 with + `playwright-core` linked from another project. Two captures of a + `file://` page in two versions gave the PNGs, a `.diff.png` and the + report "0.46 % des pixels changent…". The script closes its own + browser. +- **Node needs a recent version.** Node runs the `.ts` file directly + because it strips the types. `import.meta.main` needs Node 24.2 or later. + On an older Node, `main` silently never runs. The skill and the intention + say so. +- **Where the script goes decides who receives it.** `update` writes + anything under `.agents/`. Outside `.agents/` it writes only files that + the last manifest listed and that are still on disk. So a new + `scripts/captures.ts` at the repo root would reach fresh installs only, + never repos already equipped. A file inside the skill tree reaches + every repo through the copy of `agents/skills/` that already exists, with + no installer change. A skill already ships a script this way: + `diagnosing-bugs/scripts/hitl-loop.template.sh`. Question 1. +- **Nothing reads §J's items in the code.** Only the init test reads + *Default depth*. Adding lines to §J breaks no parser. +- **The synthesis stays as it is.** Its template says "No proofs": they are + the second reading. So the proofs are linked from the pull request's + description, not from the synthesis. + +### Files touched + +| File | Change | +|---|---| +| `socle/agents/skills/visual-proof/scripts/captures.ts` (new) and its `.agents/skills/` copy | The copy of the Harness script, with the edits of "The copy". | +| `socle/agents/skills/visual-proof/SKILL.md` (new) and its `.agents/skills/` copy | The skill. Edit 1. | +| `socle/agents/project.md.tpl` and `.agents/project.md` | §J gets four lines and a new comment. Edit 2. Only §J must be identical in the two files, since the other sections differ. | +| `socle/agents/skills/chisel-setup/SKILL.md` and its copy | A second verbatim §J question; the defaults list. Edit 3. | +| `socle/agents/workflow.md` and `.agents/workflow.md` | Steps 2, 3, 5, 7 and 8 and the depth paragraph. Edits 4 to 9. | +| `socle/templates/000-template.spec.md` and `project-management/000-template.spec.md` | The depth line and its section. Edit 10. | +| `socle/templates/000-template.work.md` and `project-management/000-template.work.md` | The `**Depth:**` line and a Context paragraph. Edit 11. | +| `socle/agents/skills/retro/SKILL.md` and its copy | The Depth line among the sources, a category, and the `x-upstream` changes. Edit 12. | +| `socle/intentions/unreleased/review-proofs.md` (new) | Migration intention. Edit 13. | +| `socle/intentions/unreleased/visual-proof.md` (new) | Informational intention. Edit 14. | +| `src/socle-files.ts` | Four lines. Edit 15. | +| `test/fixtures/golden-tree.txt` | Four lines. Edit 15. | +| `test/captures.test.ts` (new) | The capture command's tests. "The tests". | +| `test/init.test.ts` | The review-section test also checks the four new §J lines. "The tests". | +| `test/TESTS.md` | A `captures` row, and the `init` row extended. Edit 16. | + +Each socle file and its copy in this repo end byte-identical; check with +`cmp`. For `project.md`, compare §J only: +`diff <(sed -n '/^## J/,$p' socle/agents/project.md.tpl) <(sed -n '/^## J/,$p' .agents/project.md)`. +Untouched: `synthesis.md.tpl`, `src/install.ts`, `src/update.ts`, `CHARTER.md` +and `AGENTS.md`. + +### How the Node script ships (the first Node file in the socle) + +- **Installed** by the copy of `agents/skills/` that already exists, to + `.agents/skills/visual-proof/scripts/captures.ts`. No exec mode is + needed, because it runs as `node .agents/skills/visual-proof/scripts/captures.ts …` + from the project's root. The shebang stays. +- **Listed** in `src/socle-files.ts` as + `"agents/skills/visual-proof/scripts/captures.ts"`, which the integrity + test compares with the tree. The golden tree gets the four new paths. +- **Licence header** goes right after the shebang: + + ``` + // SPDX-License-Identifier: MIT + // Copied into Chisel from the Harness (vault commit a05b1092), with Olympe's + // agreement of 21/11/2026, under Chisel's licence. A copy, not a link. + ``` + + MIT is the licence in `deno.json`. The repo has no LICENSE file. +- **Deno never compiles it.** `deno check`, `lint` and `fmt` cover `src/`, + `test/` and `scripts/`. The tests run it with `node` as a subprocess + and never import it into Deno: its DOM types and `Buffer` would break + `deno check`. `deno publish` ships `socle/` as files. The module graph + starts at `src/main.ts` and does not reach the script. The gates include + `deno publish --dry-run --allow-dirty` once to confirm this. If that + command fails for a reason other than this file, I note it and move on. +- **Tested** by `test/captures.test.ts` in three layers ("The tests"): + - **Text checks.** They always run. + - **Node checks.** They are skipped when `node` is missing or older + than 24.2, which covers a CI runner on Node 20 or 22. + - **A real browser check.** It is skipped unless `CHISEL_TEST_PLAYWRIGHT` + names a `playwright-core` package directory. Here it runs with + `CHISEL_TEST_PLAYWRIGHT=/home/pierrick/projects/atlas/node_modules/playwright-core`. + +### The copy + +The Typist creates the file with the vault read-only, reading only: + + git -C "/home/pierrick/ContainersData/obsidian/vault" show "a05b1092:00-09 System/04 Harness/scripts/captures.ts" > socle/agents/skills/visual-proof/scripts/captures.ts + +Then it makes exactly these edits, and nothing else. The French stays +verbatim (question 2). + +1. **Licence.** Insert the three header lines above between line 1 (the + shebang) and line 2. +2. **Olympe's third change: the name.** In the header line, + `// harness captures : prendre` becomes `// captures : prendre`. +3. **The skill pointer** (question 2). In the header comment, + `// (skill verification-visuelle), jamais du fil principal.` becomes + `// (skill visual-proof), jamais du fil principal.` +4. **Third change, usage comment.** `// harness captures ` + becomes `// node captures.ts ` (rest of the line + unchanged). +5. **First and second changes, the comment that describes them.** Replace + the four lines from `// Playwright vient du repo où l'on se trouve` to + `// Playwright commun, pw-commun : chromium.connect …` with: + + ``` + // Playwright vient du repo où l'on se trouve (node_modules : playwright, playwright-core ou + // @playwright/test), sinon d'un playwright-core posé à côté de ce script. + // Si CHISEL_PLAYWRIGHT_WS est définie, le navigateur est celui du serveur Playwright qu'elle désigne : + // chromium.connect avec exposeNetwork '', qui lui montre le localhost de ce client. + ``` +6. **Third change, the two usage errors** in `parseArgs`: each + `usage : harness captures ` becomes + `usage : node captures.ts `. +7. **First change.** In `chargerPlaywright`, + `const essais = [process.cwd(), ...repos()];` becomes + `const essais = [process.cwd()];` +8. **First change.** Delete the whole `function repos(): string[] { … }` + (five lines) and the blank line after it. `homedir`, `existsSync` + and `readdirSync` stay: `chromeEnCache` uses them. +9. **Second change.** In `voieNavigateur`, `env.HARNESS_PLAYWRIGHT_WS` + becomes `env.CHISEL_PLAYWRIGHT_WS`. +10. **The skill pointer.** In `rapport`, `(skill verification-visuelle).` + becomes `(skill visual-proof).` +11. **Third change, the error prefix.** In the last line, + `` `harness captures : ${ `` becomes `` `captures : ${ ``. + +Check: `grep -n -i "harness\|repos()\|verification-visuelle\|crewbox\|/kit" ` +finds only the licence line's "Harness". The diff against the vault copy +shows these hunks and no other. + +### The tests + +`test/captures.test.ts`, written first; the text test is red until the +copy exists: + +```ts +// The capture command of the visual-proof skill: a copy of another project's +// script, run by Node, never imported into Deno. The text checks always run; +// the Node checks run when Node 24.2 or later is there; the browser check +// runs only when CHISEL_TEST_PLAYWRIGHT names a playwright-core directory. + +import { + assert, + assertEquals, + assertMatch, + assertStringIncludes, +} from "@std/assert"; +import { join, toFileUrl } from "@std/path"; +import { REPO_ROOT } from "./helpers.ts"; + +const SCRIPT = join( + REPO_ROOT, + "socle", + "agents", + "skills", + "visual-proof", + "scripts", + "captures.ts", +); + +function recentNode(): boolean { + try { + const out = new Deno.Command("node", { + args: ["--version"], + stdout: "piped", + stderr: "null", + }).outputSync(); + if (!out.success) return false; + const [major, minor] = new TextDecoder().decode(out.stdout).trim() + .replace(/^v/, "").split(".").map(Number); + return major > 24 || (major === 24 && minor >= 2); + } catch { + return false; + } +} + +const NODE = recentNode(); +const PLAYWRIGHT = Deno.env.get("CHISEL_TEST_PLAYWRIGHT"); + +async function node( + args: string[], + cwd?: string, +): Promise<{ code: number; stdout: string; stderr: string }> { + const out = await new Deno.Command("node", { + args, + cwd, + stdout: "piped", + stderr: "piped", + }).output(); + const decode = (bytes: Uint8Array) => new TextDecoder().decode(bytes); + return { + code: out.code, + stdout: decode(out.stdout), + stderr: decode(out.stderr), + }; +} + +Deno.test("captures: the copy carries nothing of the machines it came from", async () => { + const text = await Deno.readTextFile(SCRIPT); + assert(!/['"]projects['"]/.test(text), "no search under ~/projects"); + assert(!text.includes("HARNESS_PLAYWRIGHT_WS"), "the variable is renamed"); + assertStringIncludes(text, "CHISEL_PLAYWRIGHT_WS"); + assert(!/harness captures/i.test(text), "no « harness captures »"); + assert( + !text.includes("ContainersData") && !text.includes("obsidian"), + "no vault path", + ); +}); + +Deno.test({ + name: "captures: a missing argument is a usage error under its own name", + ignore: !NODE, + async fn() { + const result = await node([SCRIPT]); + assertEquals(result.code, 1, result.stderr); + assertMatch(result.stderr, /^captures : usage : node captures\.ts /); + }, +}); + +Deno.test({ + name: "captures: CHISEL_PLAYWRIGHT_WS names the remote browser", + ignore: !NODE, + async fn() { + const probe = `import { voieNavigateur } from ${ + JSON.stringify(toFileUrl(SCRIPT).href) + }; +console.log(JSON.stringify([ + voieNavigateur({ CHISEL_PLAYWRIGHT_WS: "ws://pw:3000" }), + voieNavigateur({ HARNESS_PLAYWRIGHT_WS: "ws://pw:3000" }), +]));`; + const result = await node(["--input-type=module", "-e", probe]); + assertEquals(result.code, 0, result.stderr); + assertEquals(JSON.parse(result.stdout), [ + { voie: "distant", ws: "ws://pw:3000" }, + { voie: "local" }, + ]); + }, +}); + +function page(title: string, colour: string): string { + return `${title}` + + `

${title}

`; +} + +Deno.test({ + name: "captures: a page captured twice gives the captures, a diff map and a report", + ignore: !NODE || !PLAYWRIGHT, + async fn() { + const work = await Deno.makeTempDir({ prefix: "chisel-captures-" }); + try { + await Deno.mkdir(join(work, "node_modules")); + await Deno.symlink( + PLAYWRIGHT!, + join(work, "node_modules", "playwright-core"), + ); + let body = page("Before", "#ffffff"); + const stop = new AbortController(); + const server = Deno.serve( + { hostname: "127.0.0.1", port: 0, signal: stop.signal, onListen() {} }, + () => + new Response(body, { + headers: { "content-type": "text/html; charset=utf-8" }, + }), + ); + const base = `http://127.0.0.1:${server.addr.port}`; + const capture = (out: string, ...more: string[]) => + node( + [SCRIPT, base, "/", "--out", join(work, out), "--largeurs", "390", + ...more], + work, + ); + try { + const before = await capture("before", "--json"); + assertEquals(before.code, 0, before.stderr); + assert( + (await Deno.stat(join(work, "before", "accueil-390.png"))).isFile, + "the first run writes the capture", + ); + + body = page("After", "#ffcc00"); + const after = await capture( + "after", + "--avant", + join(work, "before"), + "--json", + ); + assertEquals(after.code, 0, after.stderr); + const report = JSON.parse(after.stdout) as { + diffs: { fichier: string; statut: string }[]; + }; + assertEquals( + report.diffs.map((d) => [d.fichier, d.statut]), + [["accueil-390.png", "change"]], + ); + assert( + (await Deno.stat(join(work, "after", "accueil-390.diff.png"))) + .isFile, + "a changed screen gets its diff map", + ); + + const again = await capture("again", "--avant", join(work, "after")); + assertEquals(again.code, 0, again.stderr); + assertStringIncludes(again.stdout, "accueil-390.png : identique"); + assertStringIncludes(again.stdout, "sous-agent (skill visual-proof)"); + } finally { + stop.abort(); + await server.finished; + } + } finally { + await Deno.remove(work, { recursive: true }); + } + }, +}); +``` + +`deno fmt` may reflow this. Run `deno fmt test/captures.test.ts` after +writing it; `deno fmt --check` is a gate. + +`test/init.test.ts`, the test "init: the review section and the synthesis +template are installed": after the `Default depth` assertion, add: + +```ts + for ( + const label of [ + "E2E command", + "Recording command", + "Screenshot command", + "Proofs folder", + ] + ) { + assert( + glueItem(glueSection(glue, "J"), label) !== undefined, + `§J declares the ${label} line`, + ); + } +``` + +This is red until Edit 2 lands. The no-screen-no-capture criterion has no +test: it is a dry run at the close ("Decisions the spec left open"). + +### Writing rules for the Typist + +Copy the text below exactly. Prose lines are 80 columns at most; every +paragraph touched is reflowed, and the blocks below already are. Shipped +text names a decision by its title, never by its number. When a "replace" +target below does not match the file word for word, stop and report: do +not overwrite. + +### Edit 1 — the skill, `socle/agents/skills/visual-proof/SKILL.md` + +The whole file: + +````markdown +--- +name: visual-proof +description: Prove a change to a screen without ever reading a capture in your own thread. Covers the proofs the depth line and the diff demand, the captures taken and compared by the command this skill ships, a fresh sub-agent when an image must be looked at, and the proof files the human review links. Use when a task touches a screen (a page, a component, a stylesheet, a template, a displayed string, an image), at the plan, code and close steps of `.agents/workflow.md`, or whenever you are about to take or look at a screenshot. +--- + +# Visual proof + +A capture read in your own thread stays in its context and is read again at +every later call. One session read 22 captures, about 10 MB, and cost about +ten dollars. This skill does the mechanical work without a model, and +leaves the looking to a sub-agent and to the human. + +## The project's commands + +They are in §J · Review of `.agents/project.md`: + +- **E2E command**: runs the end-to-end tests. +- **Recording command**: runs them and keeps a video. +- **Screenshot command**: captures pages and compares them before → after. + The project usually names the command this skill ships, + `node .agents/skills/visual-proof/scripts/captures.ts`. +- **Proofs folder**: where the proof files go, committed with the work. + +A line left at _(none …)_ means the project has no command of that kind. +Then the task has no proof of that kind, and the review says so. Never +invent a command. The app the commands run against is started as the +Browser check line of §F · Gate commands says. + +## Which proofs: the depth line and the floor + +1. **Read the depth line.** The spec's `**Review depth:**` line is + `full` or `strategic`, followed by each proof the Architect asks for + after a `+`: `captures`, `recording`, `e2e`. For example, + `strategic + captures`. When the spec has no such line, the depth is + the default of §J and the only proofs are the floor's. +2. **Compute the floor from the diff.** Use the plan at the plan step and + the real diff at the close. The diff touches a screen when it changes + what a user sees: a page, a component, a stylesheet, a template, a + displayed string, an image or a font. Judge from the diff, not from path + patterns. A screen touched makes the floor `captures`. Otherwise the + floor is none. +3. **The proofs to produce** are the line's plus the floor's. A screen + touched gets captures even when the line left them out. Never produce + fewer proofs than the floor. Capture only the screens the diff touches, + at the widths they need (`--largeurs`): the captures are committed, and + every image weighs in the repo's history. +4. **No floor and no proof asked: no capture.** Take no capture and start + no browser. Write it in the depth record and stop here. + +## When: before, during, after + +- **Plan step.** The plan names the screens touched, with their paths and + widths, and the proofs to produce. +- **Before the first code change.** Take the before captures of the + screens that already exist, from the base: + ` --out /before`. + A new screen has no before. +- **Once the work is typed.** Check the screen yourself: run the E2E + command, through the Recording command when the depth asks for a + recording. When the project has no e2e, the capture command's report is + the least you check. This check is for you. It joins the proofs only + when the depth line asks for `e2e` or `recording`. +- **At the close.** Take the after captures, compared with the before: + ` --out /after --avant /before`. + +## Mechanical first + +The capture command writes the captures to disk and prints a text report, +in French. Widths default to 390 and 1280 (`--largeurs 390,1280`). +`--avant ` compares each capture with the one of the same name in +that folder, at the pixel. Each screen gets one of these verdicts: + +- `identique`: nothing changed; +- a share of pixels changed, with the zone and a `.diff.png` map; +- `pas de capture avant`: a new screen; +- `la taille change`: the size changed. + +The report also gives: + +- an overflow at each width (`DÉBORDE`); +- console errors; +- requests that leave the site; +- content hidden below the fold of a scrolling container (`SOUS LE PLI`). + Run again with `--plein` to capture it. + +Other options: + +- `--sombre` captures the dark colour scheme; +- `--clic `, repeated, clicks before the capture: a menu, a tab, + an accordion; +- `--json` prints the same facts as JSON. + +Often the text is enough. `identique` where nothing should change is +verified. An overflow at 390 px is a bug: fix it before anyone looks. + +The command needs these, run from the project's root: + +- Node 24.2 or later. An older Node silently does nothing. +- Playwright in the project's `node_modules`: `playwright`, + `playwright-core` or `@playwright/test`. +- A Chromium that Playwright installed. + +When `CHISEL_PLAYWRIGHT_WS` is set, it names a remote Playwright server, +and the command uses that server's browser instead of a local one. + +The script is TypeScript for Node, not for the project's own build. A +project whose linter or type checker reaches `.agents/` excludes the +script, `.agents/skills/visual-proof/scripts/captures.ts`. + +## Looking: a sub-agent, never you + +Never open a capture with your own Read tool, not even one. When the text +is not enough, launch a fresh sub-agent on the mid tier of +`.agents/reference.md`, and give it: + +- the paths of the captures, the `.diff.png` maps and the text report; +- the precise question; +- the list of what it must find on each capture; +- the rule that what it cannot see is « not verified », never « absent »; +- the form of its report: for each capture, compliant or not, and where + each defect sits; no general description; +- the order to change nothing. + +Use a fresh sub-agent for each round. A sub-agent that saw the old version +sees what it expects. + +## The proofs at the review + +The proof files stay in the proofs folder, committed with the work. The +pull request's description links each one: for a changed screen, the +before and the after side by side, with the `.diff.png`. The human looks at +them himself. You write the paths without having looked at the images. A +kind of proof the depth asks for, which the project has no command for, is +named there as missing. + +## The depth record + +At the close, write the work document's `**Depth:**` line. It gives the +depth chosen, the floor the diff computed, and, when the task went above +the floor, what it added and why. The `retro` skill compares the two. +```` + +### Edit 2 — §J, `socle/agents/project.md.tpl` and `.agents/project.md` + +Replace, in both files, the section from `## J · Review` to the end of the +file: + +```markdown +## J · Review + + + +- **Default depth:** full +- **E2E command:** _(none — example: `npm run test:e2e`)_ +- **Recording command:** _(none — example: `npx playwright test --video on`)_ +- **Screenshot command:** _(none — example: `node .agents/skills/visual-proof/scripts/captures.ts`)_ +- **Proofs folder:** beside the spec, named by replacing `.spec.md` with `.proofs/` +``` + +This repo has no screen, so the three commands stay at none in +`.agents/project.md`. + +### Edit 3 — `chisel-setup/SKILL.md` + +(a) In Step 2's defaults list, replace +`merge and publish left to the human; review depth `full`).` with +`merge and publish left to the human; review depth `full`; proof commands +from `package.json`, else none).` and reflow that list item. + +(b) Replace the line `Write the answer on §J's one line, *Default depth*.` +with: + +```markdown +Write the answer on §J's line *Default depth*. Then ask the second +question. + +### §J — then ask this, verbatim + +> **Which commands prove a screen in this project? Each one is optional.** +> +> 1. **E2E**: the command that runs the end-to-end tests (example: +> `npm run test:e2e`). +> 2. **Recording**: the command that runs them and keeps a video +> (example: `npx playwright test --video on`). +> 3. **Screenshots**: the command that captures pages and compares them +> before → after. +> +> Answer « none » for any the project lacks: the task has no proof of that +> kind, and the review says so. +> +> Recommended: the e2e and recording commands found in `package.json`, else +> none; for screenshots, the capture command chisel ships, +> `node .agents/skills/visual-proof/scripts/captures.ts`, when Playwright +> is among the project's dependencies, else none. + +Write each answer on its §J line: *E2E command*, *Recording command*, +*Screenshot command*. Leave *Proofs folder* as the reference writes it, +unless the human names another folder. +``` + +### Edit 4 — `workflow.md`, step 2 + +In the paragraph "**2. Write or sharpen the spec — Architect.**", replace +the sentence + +"The spec carries a `**Review depth:**` line, `full` or `strategic`, when +the task departs from the default of §J · Review of `.agents/project.md`, +and a `**One shot:**` line when the Architect takes the one shot ("The one +shot", below)." + +with + +"The spec carries a `**Review depth:**` line when the task departs from the +default of §J · Review of `.agents/project.md`. The line gives `full` or +`strategic`, then each proof the Architect asks for after a `+` +(`captures`, `recording`, `e2e`), as in `strategic + captures`. The spec +also carries a `**One shot:**` line when the Architect takes the one shot +("The one shot", below)." + +Then reflow the whole paragraph. + +### Edit 5 — `workflow.md`, step 3 + +In "**3. Plan — Mason.**", replace +"program design there: files, seam signatures, test order, the decisions the +spec left to the implementation." +with +"program design there: files, seam signatures, test order, the decisions the +spec left to the implementation, and, when the task touches a screen, the +screens and the proofs the `visual-proof` skill asks for." +and reflow the paragraph. + +### Edit 6 — `workflow.md`, step 5 + +In "**5. Code — a Typist the Mason launches.**", after the sentence ending +"test-first at the agreed seams (the `tdd` skill).", insert: +"When the task touches a screen, the before captures are taken before the +first code change, and the screen is checked once it is typed, as the +`visual-proof` skill says." +Reflow the paragraph: it already has a short line ("agreed seams (the +`tdd` skill). Tick"), which the reflow removes. + +### Edit 7 — `workflow.md`, step 7 + +In "**7. Close — Mason.**", after "Tick the spec's acceptance criteria +against reality.", insert: +"When the task touches a screen, take the after captures into the proofs +folder of §J · Review. Write the work document's `**Depth:**` line: the +depth chosen, the floor the diff computed with the `visual-proof` skill, +and why the task went above the floor when it did." +Then reflow the paragraph. + +### Edit 8 — `workflow.md`, step 8, the proofs bullet + +Replace the bullet +"- **Proofs: what the floor demands.** The proofs the project's floor + asks for, read after the synthesis and before the guide." +with: + +```markdown +- **Proofs: what the depth and the floor demand.** The captures, + recordings and e2e results the spec's depth line asks for, plus the + captures the floor adds when the diff touches a screen. They are read + after the synthesis and before the guide. They are files in the proofs + folder of §J · Review, committed with the work. The pull request's + description links each one, with a before → after pair for each changed + screen. The human looks at them himself. A kind of proof the project has + no command for is named there as missing. +``` + +### Edit 9 — `workflow.md`, the depth paragraph of step 8 + +Replace the paragraph "How far the human goes is the spec's +`**Review depth:**` line … `strategic` never skips the proofs." with: + +```markdown +How far the human goes is the spec's `**Review depth:**` line, or §J · +Review of `.agents/project.md` when the spec has none. `strategic` is the +synthesis plus the proofs; `full` goes down to the reading guide. The diff +stays a floor: `strategic` never skips the proofs, and a screen touched +brings captures whatever the line says. +``` + +### Edit 10 — the spec template, both copies + +(a) Replace the line `**Review depth:** full | strategic` with +`**Review depth:** full | strategic [+ captures] [+ recording] [+ e2e]`. + +(b) Replace the body of the section "## Review depth" (the paragraph +"The `**Review depth:**` line says … gives the default.") with: + +```markdown +The `**Review depth:**` line says how far down the human goes at the human +review, and which proofs the Architect asks for. It starts with one of the +two depths that step 8 of [workflow.md](/.agents/workflow.md) defines. +Each proof wanted follows after a `+`: `captures`, `recording`, `e2e`, as +in `strategic + captures`. The diff only adds a floor: a screen touched +brings captures even when the line leaves them out (the `visual-proof` +skill). Keep what the task needs. Or delete the line: the review section +of `.agents/project.md` then gives the default depth, and the only proofs +are the floor's. +``` + +### Edit 11 — the work template, both copies + +(a) In "## Context", after the paragraph "**The Architect reads it and +approves the plan.** …", insert: + +```markdown +**The close records the depth.** At the close the Mason writes the +`**Depth:**` line: the depth the spec chose, the floor the diff computed +with the `visual-proof` skill, and why the task went above the floor when +it did. The `retro` skill compares the two across tasks. +``` + +(b) In the template block, after the `` line, +insert: + +```markdown + +**Depth:** written at the close. + +``` + +### Edit 12 — `retro/SKILL.md`, both copies + +(a) Under "**Corroborating**", replace the work-document bullet with: + +```markdown +- Its **work document** — the program design, the implementation checkboxes, + the worklog, Notes & Snippets and the review findings, including + whatever was noted without stopping along the way, and its `**Depth:**` + line: the depth chosen and the floor the diff computed. +``` + +(b) In step 3, after the "**Information access**" bullet, add: + +```markdown +- **Depth against floor**: read the `**Depth:**` line of this task's work + document and of the recently archived ones. A task above the floor + with no reason given is a candidate. So is a run of tasks above the floor: + either the floor is too low, or the Architect asks for more than the work + needs. _Use when_ the depth chosen and the floor differ. +``` + +(c) In the frontmatter `changes:` string, before the closing `."`, add: +`; compares the depth each task chose with the floor its diff computed, from the work documents' Depth lines`. +Keep it on one line. + +### Edit 13 — `socle/intentions/unreleased/review-proofs.md` + +```markdown +--- +id: unreleased/review-proofs +classification: migration +--- + +# The glue names the commands that prove a screen + +## Goal + +The "J · Review" section of `.agents/project.md` declares the project's +e2e, recording and screenshot commands, each optional, and the folder the +proofs go in. + +## Why + +When a task touches a screen, the agent checks it itself, and the human +review shows the proof: at least a capture, before → after when the screen +existed. The workflow and the `visual-proof` skill read the commands in +the glue. When a command is left at none, the task has no proof of that +kind and the review says so, instead of guessing a command. + +## Applies When + +- `.agents/project.md` has a "J · Review" section without one of the + lines `E2E command`, `Recording command`, `Screenshot command` or + `Proofs folder`. + +## Do Not Apply When + +- The glue has no "J · Review" section. The intention that adds the + section comes first, and this one applies after it. + +## Observable Gaps + +1. **The command lines.** Signal: §J lacks one of the three command + lines. Ask the commands question of the setup skill, and write each + answer on its line. For an answer of none, write the reference's line + as it stands. + Done when: §J has the three command lines. +2. **The proofs folder.** Signal: §J has no `Proofs folder` line. Write + the reference's line, unless the human names another folder. + Done when: the line exists. + +## Out of Scope + +- The `Default depth` line. +- Taking any proof. + +## Reference Paths + +- `.agents/project.md` — **adapt**: the section of the reference, with + the project's answers. +- `.agents/skills/chisel-setup/SKILL.md` — **copy**: the question. + +## Validation + +- The `## J · Review` section of `.agents/project.md` has the lines + `E2E command`, `Recording command`, `Screenshot command` and + `Proofs folder`. + +## Record Result + +`chisel record unreleased/review-proofs --applied`, or +`--skipped ""` after the human's word. +``` + +### Edit 14 — `socle/intentions/unreleased/visual-proof.md` + +```markdown +--- +id: unreleased/visual-proof +classification: informational +--- + +# A screen touched is proved, and the proof is shown + +## Goal + +The human knows how a task that touches a screen is now proved. It gets +captures, before → after, from the capture command that ships with the +`visual-proof` skill. The agent checks the screen itself, and never reads +a capture in its own thread. The spec's depth line can ask for proofs. +The close records the depth chosen and the floor, and `retro` compares +them. + +## Why + +A human review that shows only code never shows the screen a user will +see. And an agent that reads its own captures pays for every image again +at each call: one session read 22 of them for about ten dollars. The +capture command compares at the pixel and answers in text; when an image +must be looked at, a fresh sub-agent does it, and the human sees the images +himself. Recording the depth against the floor shows an Architect who +always asks for more than the diff needs. + +## Applies When + +- The repo is updated from a version with no `visual-proof` skill. + +## Do Not Apply When + +- Never: there is nothing to apply. The skill, its capture command, the + workflow and the templates are managed files, and the copy that + `chisel update` makes carries the change. The session only reads it to + the human. + +## Observable Gaps + +1. **What the human knows.** Signal: none in the repo. Say it to the + human in a few sentences: + - The capture command is + `node .agents/skills/visual-proof/scripts/captures.ts`. It needs Node + 24.2 or later, and Playwright in the project's own dependencies. + `CHISEL_PLAYWRIGHT_WS` can name a remote Playwright server. + - A screen touched always brings captures. The spec's + `**Review depth:**` line can ask for more after a `+`: `captures`, + `recording`, `e2e`. + - The proofs are files in the folder §J names, linked from the pull + request's description. + - The work document's `**Depth:**` line records the depth chosen + against the floor, and `retro` reads it. + + Done when: the human has read it. + +## Out of Scope + +- The commands of §J, which the migration intention on the review's + commands asks for. +- A page that shows the proofs; for now they are files. + +## Reference Paths + +- `.agents/skills/visual-proof/SKILL.md` — **copy**, by the update. +- `.agents/skills/visual-proof/scripts/captures.ts` — **copy**, by the + update. +- `.agents/workflow.md` — **copy**, by the update. +- `.agents/skills/retro/SKILL.md` — **copy**, by the update. + +## Validation + +- Nothing to check in the repo: the closing update carries the change. + +## Record Result + +The closing `chisel update` records it, with the other informational +intentions. +``` + +The two templates of the task workspace are not under `.agents/`, so +`update` writes them only where the last manifest listed them. That is the +case for every equipped repo. + +### Edit 15 — `src/socle-files.ts` and `test/fixtures/golden-tree.txt` + +`src/socle-files.ts`: + +- after `"agents/skills/tdd/tests.md",`, add + `"agents/skills/visual-proof/SKILL.md",` and + `"agents/skills/visual-proof/scripts/captures.ts",`; +- after `"intentions/unreleased/one-shot.md",`, add + `"intentions/unreleased/review-proofs.md",`; +- after `"intentions/unreleased/review-section.md",`, add + `"intentions/unreleased/visual-proof.md",`. + +`test/fixtures/golden-tree.txt`, after `.agents/skills/tdd/tests.md`: + +``` +.agents/skills/visual-proof +.agents/skills/visual-proof/SKILL.md +.agents/skills/visual-proof/scripts +.agents/skills/visual-proof/scripts/captures.ts +``` + +### Edit 16 — `test/TESTS.md` + +(a) In the `init` row, after "the glue carries §J · Review", add +", with its default depth, its three proof commands and its proofs folder". + +(b) Add this row after the `usage` row: + +```markdown +| `captures` | The capture command the `visual-proof` skill ships is the copy agreed with its author, made generic: no search under `~/projects`, no Harness variable or name, no vault path. Under Node 24.2 or later, a missing argument is a usage error under its own name, and `CHISEL_PLAYWRIGHT_WS` selects the remote browser. When `CHISEL_TEST_PLAYWRIGHT` names a `playwright-core` directory, a page served twice gives its capture, a `change` verdict with a `.diff.png`, then an `identique` verdict in the text report. Without Node or Playwright, those tests are skipped. | The copy took back a machine-specific path or name, or the command stopped capturing, comparing or reporting. | +``` + +### Decisions the spec left open (my calls, unless the Architect rules) + +- **The floor is judged, not matched.** Decision 13 set path patterns + aside. The skill says what "touches a screen" means, and the Mason + judges from the diff. +- **A Screenshot command of none means no captures, even though Chisel + ships one** (question 6). +- **The before captures come from the base**, taken by the Typist before + its first code change; the after captures come at the close. Both go + under `/before` and `/after`. +- **The no-screen-no-capture dry run is this slice.** This repo has no + front, so at the close I apply the skill to this slice's diff: the floor + is none, the spec asks for no proof, so I take no capture and create no + `04-visual-proof.proofs/`. The `**Depth:**` line records it. The + music-downloader dry run of the Notes becomes an open item in the close + report, for when a checkout exists (question 5). +- **The capture-tool criterion is met by the browser test**, which I run + here with `CHISEL_TEST_PLAYWRIGHT` set. Its output goes in the worklog. + +### Order + +Vertical steps, each committed green (`deno task check`, `deno task test`): + +1. Write `test/captures.test.ts` (red). Make the copy and its edits. Run + the test with and without `CHISEL_TEST_PLAYWRIGHT` (green). +2. The SKILL.md (Edit 1). Copy the whole `visual-proof/` folder into + `.agents/skills/`. Add the four golden-tree lines and the two skill + lines of `socle-files.ts` (Edit 15). The integrity, init and check + tests are green. Steps 1 and 2 make one commit, so the golden tree + changes once. +3. The init test extension (red), then §J in both files (Edit 2), then + chisel-setup (Edit 3) (green). +4. Workflow (Edits 4 to 9), templates (Edits 10, 11), retro (Edit 12), each + in both copies; `cmp` each pair. +5. The intentions (Edits 13, 14) and their `socle-files.ts` lines; TESTS.md + (Edit 16). +6. Gates: `deno task check`, `deno task test`, the browser test with + `CHISEL_TEST_PLAYWRIGHT`, `deno task release-check gate origin/main`, + `deno publish --dry-run --allow-dirty` once. + +Commits: `feat(socle): ship the capture command and the visual-proof +skill` (steps 1–2), `feat(socle): the review section names the proof +commands` (step 3), `feat(socle): the depth line asks for proofs and the +close records the floor` (step 4), `docs(socle): intentions for the visual +proof` (step 5). + +### Questions for the Architect + +1. **Where the script goes.** + - (a) In the skill, `socle/agents/skills/visual-proof/scripts/captures.ts`. + The existing tree copy installs it, `update` brings it to every + equipped repo, and the installer does not change. + - (b) `socle/scripts/captures.ts`, installed to `scripts/captures.ts` + beside the task-id script. That needs installer code, and `update` + would not write it into repos already equipped. + + Recommended: **(a)**. The spec's note on "a first under `socle/scripts/`" + then reads "a first Node file in the socle". +2. **The copy beyond Olympe's three changes.** Four small additions, each a + consequence of the copy: + - the licence header; + - the comment describing the Playwright lookup and the remote browser, + rewritten because it described the two removed things; + - the two pointers to "skill verification-visuelle" renamed "skill + visual-proof", because the skill they name does not exist in Chisel; + - the usage written `node captures.ts`. + + The French text stays verbatim, the report included. + - (a) As above. + - (b) Also translate it to English, which would be a rewrite in all but + name. + + Recommended: **(a)**. I also keep the `.ts` extension. Risk: a project + whose linter or type check reaches into `.agents/` sees a Node + TypeScript file there. TypeScript's own globs skip dot folders, so I + flag the risk and add nothing. +3. **The format of the depth line.** + - (a) One line, `**Review depth:** strategic + captures + e2e`, which + follows the decision's own « captures + e2e ». + - (b) A separate `**Proofs:**` line. + + Recommended: **(a)**. +4. **Where the proofs go.** + - (a) A folder beside the spec, `.proofs/`, committed. The pull + request can then link the files, and the archive moves them with the + spec. + - (b) A gitignored folder. The pull request cannot link it, so the + human review cannot show it. + + Recommended: **(a)**. Videos weigh more; a project can name another + folder in §J. +5. **The dry run that replaces music-downloader.** + - (a) The browser test on fixture pages (capture-tool), plus this + slice's own close as the repo with no front touched + (no-screen-no-capture). The music-downloader dry run stays an open + item for when a checkout exists. + - (b) Also a dry run on atlas or olympe, which have Playwright. That + means touching another repo, which my brief does not allow. + + Recommended: **(a)**. +6. **A Screenshot command of none.** + - (a) No captures, as the decision on no command says, even though + Chisel ships the command. The setup question recommends the shipped + command whenever Playwright is among the dependencies. + - (b) Fall back to the shipped command when the line is none. + + Recommended: **(a)**. It keeps one rule for all three kinds. +7. **Typist tier.** Mid, as the brief says. About fifteen files, two of + them new, and code with tests. + +## Worklog + +- 2026-11-22 — Read the spec, the parent decisions, slices 01–03, the + socle files touched, the source script at a05b1092 and + `verification-visuelle` (vault, read-only). Ran a scratch copy of the + script under Node 24.13.0: two captures, a `.diff.png`, a report; the + browser closed itself. `review-videos` is not in this repo's history. + Plan written; waiting for the Architect. +- 2026-11-22 — Typist. Typed the approved plan, steps 1 to 6, in four + commits: the capture command, its test and the skill (steps 1–2); §J, + chisel-setup and the init test (step 3); workflow, templates and retro + (step 4); the two intentions and TESTS.md (step 5). Every socle file with + a copy here checked with `cmp`; §J compared with `diff`. Gates: `deno task + check` and `deno task test` green at each commit (80 passed, 1 ignored: + the browser test, when run without `CHISEL_TEST_PLAYWRIGHT`). The browser + test ran for real with `CHISEL_TEST_PLAYWRIGHT=/home/pierrick/projects/atlas/node_modules/playwright-core`: + 4 passed, 0 failed, 0 ignored (the page captured twice took 4 s). + `deno task release-check gate origin/main`: "The socle change adds an + intention." `deno publish --dry-run --allow-dirty`: success. Departure + from the plan's order: the copy was made before `test/captures.test.ts` + was written, so the text test was never seen red. The workflow + paragraphs were reflowed greedily to 80 columns, so each reflowed + paragraph's earlier lines moved too. +- 2026-11-22 — Mason. `code-review` from 157991e; findings below. Retouch + of the script's header comment (private names and topics) and one + assertion in the text test. Gates green, the browser test included: 81 + passed, 0 ignored. Close: criteria ticked, Depth line, synthesis, + journal entry 55, retro, status `done`. + +## Implementation Checkboxes + +- [x] Step 1–2 — the copy, its tests, the skill, the lists (Edits 1, 15) +- [x] Step 3 — §J and chisel-setup, init test (Edits 2, 3) +- [x] Step 4 — workflow, templates, retro (Edits 4–12) +- [x] Step 5 — intentions, TESTS.md (Edits 13, 14, 16) +- [x] Step 6 — gates, browser test, release gate, publish dry run +- [x] Code review from 157991e, findings answered +- [x] Close: criteria, depth line, synthesis, journal, retro, status + +## Notes & Snippets + +- The scratch trial lives under the session scratchpad (`cap/`). It holds no + repo file. +- `playwright-core` on this machine: + `/home/pierrick/projects/atlas/node_modules/playwright-core`. Chromium + is in `~/.cache/ms-playwright`. + +### Retro (2026-11-22, Mason) — proposals, none applied + +From this session, its Typist's report and its two reviewers. Severity +order; each waits for its owner's yes. + +1. **Automated checks** — a socle-wide test that refuses private markers + in shipped files (vault paths, Harness command names, personal names, + internal topic slugs), not only in the copied script. The plan's grep + and the first text test listed only the three things Olympe named, and + the private topics in the comments passed both. Target: `test/`, the + integrity tests. Owner: the human. +2. **Coding standards** — the 80-column rule counts characters, not bytes. + A reviewer's byte count flagged three lines with em dashes as 81. Say so + in the writing rules, with `wc -m` under a UTF-8 locale, or ship a + small check. Target: `CONTRIBUTING.md`. Owner: the human. +3. **Information access** — the spec named two sources that are not + reachable here: music-downloader's `review-videos` and its checkout. The + Architect could check at spec time that each named source exists, and + write its repo and commit in the Notes, as was done for `captures.ts`. + Target: workflow step 2. Owner: the human. +4. **Tool economy** — the Typist reflowed whole paragraphs greedily, which + moved untouched lines and made the workflow diff mostly noise for the + review. The writing rule could say: reflow from the first changed line + to the paragraph's end, and keep the earlier lines as they are. Target: + the work template's writing rules. Owner: the human. +5. **Depth against floor** — nothing to propose: this task sits at the + floor, and slices 01–03 predate the `**Depth:**` line. + +## Diff-Review Findings + +`code-review` from 157991e, two fresh reviewers (Standards, Spec), on +2026-11-22. Neither opened a PNG. + +**Standards** + +- **The copied script carried private names and topics** (hard): « les + pages d'Olympe », « go de Pierrick le 05/11 », `lot3-corrections` and two + `sujet …` slugs, in the header comment. Fixed as a retouch of five comment + lines, both copies, French kept: the incident and the internal-scroll + case stay, without names, dates or topics. The text test now also refuses + `Pierrick`, `lot3-` and `sujet captures-`. The licence lines 3–4 keep + « the Harness » and Olympe: that is the attribution ruling 2a asked for. +- **Three workflow lines over 80 columns** (hard): false positive. The + check counted bytes; with the em dash counted as one character, lines + 42, 79 and 96 are 77, 79 and 79. +- **`§J` / `· Review` split across a line in step 7**: kept. It reads + correctly; fixing it reflows the paragraph again. +- **The proofs rule and the Depth line written in several places** + (judgement): answered. Workflow step 8 and the work template each carry + the one sentence their reader needs at that point; the skill carries the + method. The same layering as the review section and the workflow in + slices 01–03. +- **The text test pins the script's source** (judgement, TESTS.md rule 1): + answered. It pins the absence of machine-specific names, which is the + criterion capture-copy-generic itself, not the socle's prose. +- **Smells in `captures.ts`** (usage string three times, a one-entry loop + left by the removed search, short names, magic numbers, French names): + answered. Ruling 2a makes the file a copy with Olympe's three changes and + nothing else; refactoring it would make the copy diverge for no + behaviour. + +**Spec** + +- **`review-videos` not used**: recorded in Program Design and accepted on + the `**Plan:**` line. +- **music-downloader dry run not done**: open item (ruling 5a), flagged in + the close report. +- **no-screen-no-capture has no test**: met by this slice's close, recorded + on the `**Depth:**` line above. +- **capture-tool rests on a run with `CHISEL_TEST_PLAYWRIGHT`**: run again + after the retouch, 81 passed, 0 ignored. +- **The copy's comment still carried Harness topics**: fixed, see + Standards. +- **The test's `['"]projects['"]` guard is weak**: answered. The code + holds no home-directory search at all (`chargerPlaywright` tries the + working directory, then beside the script); the guard is a tripwire, not + the proof. +- **Scope beyond the letter** (the chisel-setup question, retro reading + recent Depth lines, the greedy reflow): answered. The first two serve the + spec's « an agent that always asks more than the floor shows »; the + reflow is noise the Typist recorded in the worklog. + +**Human review (PR #9)** + +- **« Est-ce que tous les skills ont utilisé /writing-for-agents ? »**, on + `visual-proof/SKILL.md`. No: the slice wrote its skill text without that + skill. Fixed in 17932f7, the task's Mason, 2026-11-22. The fix covers all + the skill text the slice wrote: `visual-proof`, the depth check in + `retro`, and the proof-command question in `chisel-setup`. Gates green. +- A fresh `code-review` of that pass (slice 01's Mason) found it had + dropped meaning, and the Architect ruled. Fixed in d794142: + - the explicit rule against reading a capture in one's own thread is back + as a guardrail, with its reason; + - the capture options are back with their purpose, and the default widths + 390 and 1280; + - the plan, code and close triggers, « no general description » and + « only » the touched screens are back; + - chisel-setup recommends each proof command on its own. + + Gates green. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/05-questions-page.spec.md b/project-management/tasks/20261119-1644-relecture-humaine/05-questions-page.spec.md new file mode 100644 index 0000000..31b91b8 --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/05-questions-page.spec.md @@ -0,0 +1,35 @@ +# 05 — Questions page + +**Status:** draft +**Blocked by:** the review tool chosen after the task `relecture-analyse` + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +**What to build:** when the Architect or a Mason has questions for the +human, they leave the chat. The agent writes a questions page (each +question with its options, a recommendation, and a mockup or diagram when +it helps), Chisel serves it and gives the agent a link for the human, and +the answers come back to the agent that asked. All of it works outside the +Harness. Which tool serves the page is the one chosen after +`relecture-analyse`; this slice wires it into Chisel. Parent spec: +decisions 4, 6, 16, and "The pages, as needs". + +## Acceptance criteria + +- [ ] **questions-leave-chat** — `workflow.md`, "Blockers and questions", + sends questions to the page. +- [ ] **pages-without-harness** — Chisel serves the page, and an answer + given on it reaches the agent, with no Harness command involved. +- [ ] **intention-per-change** — the Intention gate passes. +- [ ] **suite-green** — `deno task check` and `deno task test` pass. + +--- + +> 🧑 **REVIEW IF RELEVANT** — notes written before the work document exists. + +## Notes + +- Apollon's `outils/formulaire.mjs` (31 lines of Node) is one input for the + tool. diff --git a/project-management/tasks/20261119-1644-relecture-humaine/06-pre-development-report.spec.md b/project-management/tasks/20261119-1644-relecture-humaine/06-pre-development-report.spec.md new file mode 100644 index 0000000..90f842c --- /dev/null +++ b/project-management/tasks/20261119-1644-relecture-humaine/06-pre-development-report.spec.md @@ -0,0 +1,38 @@ +# 06 — Pre-development report and proofs page + +**Status:** draft +**Blocked by:** 01 — Human review with crit; 05 — Questions page + +--- + +> 🧑 **REVIEW CAREFULLY** — human decision surface. Read it all before code. + +**What to build:** once the questions are answered, the human reads in the +browser what will be done, « une sorte de .spec mais chargé dans le +browser ». Its look comes first: real variants of the report and of the +review, chosen by Pierrick, before any form or tool (« faut se concentrer +sur la UX »). The Mason fills it at the plan step with the same parts the +final review shows (what changes, the files touched, the data model before +→ after, the flows), so the gap between planned and done shows at once; how +the two sit side by side is the tool's. On the same tool, the proofs page +shows the screenshots, comparisons and videos of slice 04, linked from the +review. Parent spec: decisions 6, 15, 17. + +## Acceptance criteria + +- [ ] **plan-step-writes-report** — the plan step of `workflow.md` asks for + the report, in the shared form. +- [ ] **report-served** — Chisel serves the report and gives the human its + link, with no Harness command involved. +- [ ] **proofs-page-served** — Chisel serves the proofs page, and the human + review links it. +- [ ] **intention-per-change** — the Intention gate passes. +- [ ] **suite-green** — `deno task check` and `deno task test` pass. + +--- + +> 🧑 **REVIEW IF RELEVANT** — notes written before the work document exists. + +## Notes + +_None yet._ diff --git a/socle/agents/discipline.md b/socle/agents/discipline.md index 151d0b0..6bf202e 100644 --- a/socle/agents/discipline.md +++ b/socle/agents/discipline.md @@ -1,7 +1,7 @@ # Discipline — the ambient core These rules apply to **every** conversation in this repo, with or without a -task artifact. A one-shot fix runs under the same discipline as a sliced +task artifact. A quick fix runs under the same discipline as a sliced feature; the only difference is the paperwork. 1. **Read before acting.** At session start, read the reading list declared in @@ -9,7 +9,7 @@ feature; the only difference is the paperwork. most recent journal entries). Say which documents and rules you are working under. -2. **Plan first.** Even for a one-shot fix: say what you are about to do +2. **Plan first.** Even for a quick fix: say what you are about to do before doing it. Nothing half-decided crosses into code. When the work has a spec document, the program design is PERSISTED into its matching work document and approved by the Architect before any code — the "Plan" and @@ -17,21 +17,22 @@ feature; the only difference is the paperwork. 3. **🧑 zones are law.** Sections marked 🧑 in a spec document carry the decisions of whoever approved them — the human, unless the Architect - approved a spec that carried no new decision ("Zone ownership" in - `.agents/reference.md`). Never contradict one silently: if the work - reveals a conflict with a 🧑 zone, stop and surface it. + approved a spec that carried no new decision, or one of a task in one + shot ("Zone ownership" in `.agents/reference.md`). Never contradict one + silently: if the work reveals a conflict with a 🧑 zone, stop and + surface it. 4. **Verify before "done".** Run the project's gate commands declared in `.agents/project.md` §F (lint, tests, build; a browser check when UI behaviour changed). Evidence first — red output is reported as red, never narrated as green. -5. **The bridge rule.** No task artifact for casual conversation or one-shot - work. But when a conversation turns into real, scoped, multi-step work, - recognize it and PROPOSE a task under `.agents/workflow.md` — inform, - never force. Formality is opt-in; detection is not. Most work should stay - small: if everything becomes a big feature, review gets diluted and the - method has failed. +5. **The bridge rule.** No task artifact for casual conversation or a + quick fix. But when a conversation turns into real, scoped, multi-step + work, recognize it and PROPOSE a task under `.agents/workflow.md` — + inform, never force. Formality is opt-in; detection is not. Most work + should stay small: if everything becomes a big feature, review gets + diluted and the method has failed. 6. **Escalate, don't improvise.** Blocked twice on the same thing, or pushed outside the approved plan → stop and report to whoever launched you. The @@ -88,7 +89,7 @@ Not everything starts as a feature idea: | Something's broken (hard bug, flake, regression) | `diagnosing-bugs` — build a repeatable failing check first, THEN theorize; regression test before the fix | the fix lands as normal work | | A design question that talking cannot settle | `prototype` — throwaway code, one command to run; keep the answer, and keep the code on a throwaway branch out of main with a pointer to that branch | back into the spec | | Reading legwork (docs, API facts) | `research` — background agent, cited markdown file | feeds the spec | -| So big and foggy it cannot even be sliced | `wayfinder` — map the open DECISIONS first, resolve them one by one | then the spec document and its slices | +| So big and foggy it cannot even be sliced, or a spec interview that tangles | `wayfinder` — map the open DECISIONS first, resolve them one by one | then the spec document and its slices | | A spare moment to make the codebase nicer to work in | `improve-codebase-architecture` | produces an idea → normal flow | | A whole repo to judge, rather than one change | `codebase-audit` — blind finders one per lens, every claim reproduced, findings triaged against what was already decided | decisions and an action plan; each piece becomes a task by the normal path | diff --git a/socle/agents/methodology.md b/socle/agents/methodology.md index e847c17..a378384 100644 --- a/socle/agents/methodology.md +++ b/socle/agents/methodology.md @@ -71,8 +71,8 @@ the answer demands them. folder with one slice that duplicates the spec document. - What slicing adds is **decomposition**: blocking edges, the frontier, the order. That only has value when there are several pieces. -- Real-world distribution (dex): ~40% of work is one-shot, medium work gets a - single spec/work pair, only large work gets the full breakdown. +- Real-world distribution (dex): ~40% of work is a quick fix, medium work + gets a single spec/work pair, only large work gets the full breakdown. What IS unconditional: the check itself, stated out loud — "this fits in one pass" or "this needs slicing, here is the breakdown". And **vertical-slice diff --git a/socle/agents/project.md.tpl b/socle/agents/project.md.tpl index 0c997a5..4dbca2b 100644 --- a/socle/agents/project.md.tpl +++ b/socle/agents/project.md.tpl @@ -1,6 +1,6 @@ # Project glue - - **Merge:** ask the human - **Publish:** ask the human + +## J · Review + + + +- **Default depth:** full +- **E2E command:** _(none — example: `npm run test:e2e`)_ +- **Recording command:** _(none — example: `npx playwright test --video on`)_ +- **Screenshot command:** _(none — example: `node .agents/skills/visual-proof/scripts/captures.ts`)_ +- **Proofs folder:** beside the spec, named by replacing `.spec.md` with `.proofs/` diff --git a/socle/agents/reference.md b/socle/agents/reference.md index c95127f..ea550ec 100644 --- a/socle/agents/reference.md +++ b/socle/agents/reference.md @@ -20,7 +20,8 @@ for every session are `.agents/discipline.md`. | **Status** | The task's single state, one of the seven values of "Statuses" in `.agents/workflow.md`. | | **Frontier** | The set of slices whose blockers are all done — what can be worked on right now; a task on it has the status `ready`. | | **Expand–contract** | The sequencing for wide mechanical refactors (rename a column, retype a shared symbol): add the new form beside the old → migrate call sites in batches → delete the old form. The exception to vertical slicing. | -| **One-shot** | Work done without a task artifact. The discipline still applies; only the file bookkeeping is skipped. | +| **Quick fix** | Work done without a task artifact. The discipline still applies; only the file bookkeeping is skipped. | +| **One shot** | The lane where a task's only possible human stop is the final review, and that one only when its spec's `**One shot:**` line keeps it ("The one shot" in `.agents/workflow.md`). The other lane is the full lane. | The roles — Architect, Mason, Typist, reviewers — are defined in "The roles" of `.agents/workflow.md`. @@ -36,9 +37,11 @@ decision tickets and resolves them one at a time). A 🧑 zone belongs to whoever **approved** it. The human approves a spec that carries decisions the task did not state; the Architect approves one written from a clear task, and then the zones carry the task's own decisions, which -are the human's. The work document has no zone: it belongs to the Mason -that wrote it. A 🧑 zone is never overridden silently — a conflict with one -is surfaced, never edited sideways. +are the human's. In one shot the Architect approves the spec even when it +carries decisions of its own, and those decisions are then its own. The +work document has no zone: it belongs to the Mason that wrote it. A 🧑 zone +is never overridden silently — a conflict with one is surfaced, never +edited sideways. ## Model tiers diff --git a/socle/agents/skills/chisel-setup/SKILL.md b/socle/agents/skills/chisel-setup/SKILL.md index 43290bf..0ecdc90 100644 --- a/socle/agents/skills/chisel-setup/SKILL.md +++ b/socle/agents/skills/chisel-setup/SKILL.md @@ -8,7 +8,7 @@ disable-model-invocation: true Turn `.agents/project.md`'s defaults into this repo's actual glue, pose the current dev's personal file, and leave `AGENTS.md` speaking with one voice. -One pass, sections A through I, each confirmed before the next. Re-running +One pass, sections A through J, each confirmed before the next. Re-running later to revisit a single section is normal — treat the current file as the starting recommendation, not as done-forever. On a repo that already had a method of its own, a first `init` stages instead of installing, and this skill @@ -73,18 +73,19 @@ established is *stated* to the user, not asked. Only genuine decisions — things the scan cannot determine on its own, or choices with real alternatives — get a question. -## Step 2 — Walk sections A through I, one at a time +## Step 2 — Walk sections A through J, one at a time For each section, in letter order: 1. State any relevant facts from Step 1's scan. 2. Give your **recommended** value — prefilled from the scan plus the questionnaire defaults (root `/project-management/`; the task files as - the tracker; boilerplate reading list into - `apps/documentation`; living docs = `apps/documentation` for - boilerplate else `doc/**`; gate commands from `package.json`; glossary/ADRs - into `apps/documentation` for boilerplate else root `CONTEXT.md` + - `docs/adr/`; model tiers unset; merge and publish left to the human). + the tracker; boilerplate reading list into `apps/documentation`; living + docs = `apps/documentation` for boilerplate else `doc/**`; gate commands + from `package.json`; glossary/ADRs into `apps/documentation` for + boilerplate else root `CONTEXT.md` + `docs/adr/`; model tiers unset; + merge and publish left to the human; review depth `full`; proof commands + as §J's second question recommends). 3. Wait for the user's answer before moving to the next section. Accepting a recommendation in one word ("yes", "ok", "sounds good") is enough to move on — do not demand elaboration when the user is happy with the default. @@ -169,6 +170,48 @@ Write the answer on §I's two lines: *ask the human* for what stays with the human, *the agent, once the review is clean and the gates pass* for what is handed over. +### §J — ask this, verbatim + +> **When you review a pull request, how far down do you read?** +> +> 1. **Full** — the synthesis, the proofs, then the whole diff through the +> reading guide. +> 2. **Strategic** — the synthesis and the proofs; the diff only where +> something calls you further. +> +> A task can set its own depth on its spec's `**Review depth:**` line. +> +> Recommended: **1 — full**. + +Write `full` or `strategic` on §J's *Default depth* line. Then ask §J's +second question, below. + +### §J — then ask this, verbatim + +> **Which commands prove a screen in this project? Each one is optional.** +> +> 1. **E2E**: the command that runs the end-to-end tests (example: +> `npm run test:e2e`). +> 2. **Recording**: the command that runs them and keeps a video +> (example: `npx playwright test --video on`). +> 3. **Screenshots**: the command that captures pages and compares them +> before → after (chisel ships one: +> `node .agents/skills/visual-proof/scripts/captures.ts`). +> +> Answer « none » for any the project lacks: its tasks then carry no proof +> of that kind, and the review says so. +> +> Recommended, each on its own: +> +> - e2e: the command found in `package.json`, else none; +> - recording: the command found in `package.json`, else none; +> - screenshots: chisel's capture command when Playwright is among the +> project's dependencies, else none. + +Write each answer on its §J line: *E2E command*, *Recording command*, +*Screenshot command*. Keep the reference's *Proofs folder* unless the human +names another folder. + ## Step 3 — §E is read-back only, never asked Section E (Adapters) is written by `chisel init`, not by this questionnaire. @@ -186,8 +229,8 @@ until the end of the walk. Each write is scoped to exactly one section: - Replace everything from immediately after that heading line up to (but not including) the next `## ` heading, or end of file if there is none. - Leave every byte outside that span untouched: other sections, any content - a human added above §A or after §I, custom sections the file doesn't - define (e.g. a hand-added `## I · ...`). + a human added above §A or after §J, custom sections the file doesn't + define (e.g. a hand-added `## K · ...`). **Never rewrite the whole file.** A full-file rewrite is the one mistake that would silently discard user edits living outside the questionnaire's @@ -267,7 +310,7 @@ that page first, then follow it command by command, watching each output. This step stands alone. "Reconcile my `AGENTS.md`" runs THIS step and nothing else — no questionnaire, no sections, no network. In the walk it comes after -§I is written and before the summary. +§J is written and before the summary. A repo that had an `AGENTS.md` before chisel now has two voices in one file: the text it already carried, often describing its own way of working, and the @@ -379,8 +422,8 @@ project's own — and the step reports that and changes nothing. ## Step 8 — Closing summary -After §I is written, print a one-screen summary of what got written: one -line per section, A–I; one line for the personal file; one line for +After §J is written, print a one-screen summary of what got written: one +line per section, A–J; one line for the personal file; one line for `AGENTS.md`, saying what was deleted, what moved to the reading list and what stayed, or that the file already spoke with one voice; and, when §B named a tracker still to set up, the one thing still to do. Then suggest the natural next move: diff --git a/socle/agents/skills/retro/SKILL.md b/socle/agents/skills/retro/SKILL.md index d88d18a..f94cdfe 100644 --- a/socle/agents/skills/retro/SKILL.md +++ b/socle/agents/skills/retro/SKILL.md @@ -5,7 +5,7 @@ x-upstream: repo: mattpocock/skills path: skills/in-progress/retro sha: 6654f6b60cd9d5be8b54c6fafe44346dabeb3b76 - changes: "adapted: sources are the session transcript AND those of its subagents first, then the repo artifacts that corroborate them (the task's spec document, and its work document with the program design, the checkboxes and the worklog, plus the diff and the journal entry) — reading is unrestricted, only the WRITING of conclusions is bound to the repo by discipline.md rule 8; calls writing-great-skills, which is this same upstream skill vendored under its former name; target files resolve via .agents/project.md instead of hardcoded paths; each proposal names its target file and zone owner; nothing is ever auto-applied, and a deferred proposal gets a dated line instead of being dropped; drops disable-model-invocation — this skill is invoked by the close step of the workflow, not only on user request; a blocker is read where the task's own documents keep it rather than in the project journal." + changes: "adapted: sources are the session transcript AND those of its subagents first, then the repo artifacts that corroborate them (the task's spec document, and its work document with the program design, the checkboxes and the worklog, plus the diff and the journal entry) — reading is unrestricted, only the WRITING of conclusions is bound to the repo by discipline.md rule 8; calls writing-great-skills, which is this same upstream skill vendored under its former name; target files resolve via .agents/project.md instead of hardcoded paths; each proposal names its target file and zone owner; nothing is ever auto-applied, and a deferred proposal gets a dated line instead of being dropped; drops disable-model-invocation — this skill is invoked by the close step of the workflow, not only on user request; a blocker is read where the task's own documents keep it rather than in the project journal; compares the depth each task chose with the floor its diff computed, from the work documents' Depth lines." --- You are suggesting improvements to the **working rules** — the steering @@ -39,7 +39,8 @@ discussed: before a work document existed. - Its **work document** — the program design, the implementation checkboxes, the worklog, Notes & Snippets and the review findings, including - whatever was noted without stopping along the way. + whatever was noted without stopping along the way, and its `**Depth:**` + line. - The diff and commit messages of the session (`git log`, `git diff`). - The dated journal entry the work produced. - Any blocker, and the ruling on it, where the task keeps it: an @@ -82,6 +83,12 @@ discussed: - **Information access**: opportunities to increase access to information — tee'd logs, read-only access to a third-party service. _Use when_ a crucial piece of information was not available. +- **Depth against floor**: compare the depth chosen with the floor the diff + computed, on the `**Depth:**` line of this task's work document and of the + recently archived ones. A candidate is a task above the floor with no + reason given, or a run of tasks above it: either the floor is too low, or + the Architect asks for more than the work needs. _Use when_ the depth + chosen and the floor differ. 4. For each candidate, resolve its **target file** via `.agents/project.md` (the reading list of §C · Reading list, the living docs of diff --git a/socle/agents/skills/visual-proof/SKILL.md b/socle/agents/skills/visual-proof/SKILL.md new file mode 100644 index 0000000..69f2b04 --- /dev/null +++ b/socle/agents/skills/visual-proof/SKILL.md @@ -0,0 +1,133 @@ +--- +name: visual-proof +description: Prove a change to a screen with captures compared by a command, while a fresh sub-agent does any looking. Use when a task touches a screen (a page, a component, a stylesheet, a template, a displayed string, an image), at its plan, code and close steps, or when you are about to take or look at a screenshot. +--- + +# Visual proof + +A capture read in your own thread stays in its context and is read again at +every later call: one session read 22 captures, about 10 MB, for about ten +dollars. So the proof runs **mechanical first**: a command captures and +compares, and you read its text report. A fresh sub-agent does any looking, +and the human sees the images. + +## The project's commands + +§J · Review of `.agents/project.md` names them: + +- **E2E command**: runs the end-to-end tests. +- **Recording command**: runs them and keeps a video. +- **Screenshot command**: captures pages and compares them before → after. + It is usually the command this skill ships, + `node .agents/skills/visual-proof/scripts/captures.ts`. +- **Proofs folder**: where the proof files go, committed with the work. + +Use only the commands §J names. A line left at _(none …)_ means the task has +no proof of that kind, and the review says so. The app runs as the Browser +check line of §F · Gate commands says. + +## Which proofs: the depth line and the floor + +1. **Read the depth line.** The spec's `**Review depth:**` line is `full` + or `strategic`, then each proof the Architect asks for after a `+`: + `captures`, `recording`, `e2e` (for example `strategic + captures`). + With no such line, the depth is §J's default and asks for no proof. +2. **Compute the floor from the diff**: the plan at the plan step, the real + diff at the close. The diff touches a screen when it changes what a user + sees: a page, a component, a stylesheet, a template, a displayed string, + an image or a font. Judge it from the diff; path patterns miss cases. A + screen touched makes the floor `captures`; otherwise the floor is none. +3. **List the proofs**: the line's plus the floor's, so a screen touched + gets captures even when the line left them out. Capture only the screens + the diff touches, each with its path and only the widths it needs + (`--largeurs`): every committed image weighs in the repo's history. + Done when every screen touched has its widths and every proof asked has + a line. +4. **Empty list: stop.** No floor and no proof asked means no capture and + no browser. Write it in the depth record. + +## When: before, during, after + +- **Plan step.** The plan carries the list of step 3. +- **Before the first code change.** Capture, from the base, each listed + screen that already exists: + ` --out /before`. + A new screen has no before. +- **Once the work is typed.** Check the screen yourself: run the E2E + command, through the Recording command when the depth asks for a + recording. With no e2e, check at least the capture command's report. This + check is for you; it joins the proofs only when the depth line asks for + `e2e` or `recording`. +- **At the close.** Capture the after, compared with the before: + ` --out /after --avant /before`. + Done when every listed screen has its after capture and its verdict. + +## Mechanical first + +The capture command writes the captures to disk and prints a text report, +in French. Its options: + +- `--largeurs` sets the widths, 390 and 1280 by default; +- `--avant ` compares each capture, at the pixel, with the one of + the same name in that folder; +- `--clic `, repeated, clicks before the capture, to open a + menu, a tab or an accordion; +- `--sombre` captures the dark colour scheme; +- `--plein` grows the window until a scrolling container shows everything; +- `--json` prints the same facts as JSON. + +With `--avant`, each screen gets a verdict: + +- `identique`: nothing changed; +- a share of pixels changed, with the zone and a `.diff.png` map; +- `pas de capture avant`: a new screen; +- `la taille change`: the size changed. + +The report also gives an overflow at each width (`DÉBORDE`), console +errors, requests that leave the site, and content hidden below the fold of +a scrolling container (`SOUS LE PLI`: run again with `--plein`). + +Often the text settles it. `identique` where nothing should change is +verified. An overflow at 390 px is a bug: fix it before anyone looks. + +The command runs from the project's root and needs: + +- Node 24.2 or later. On an older Node it silently does nothing. +- Playwright in the project's `node_modules` (`playwright`, + `playwright-core` or `@playwright/test`) and a Chromium it installed, or + a remote Playwright server named by `CHISEL_PLAYWRIGHT_WS`. + +The script is TypeScript for Node, outside the project's own build. A +project whose linter or type checker reaches `.agents/` excludes the +script, `.agents/skills/visual-proof/scripts/captures.ts`. + +## Looking: a fresh sub-agent + +When the text does not settle it, a fresh sub-agent on the mid tier of +`.agents/reference.md` looks, and you read its report. Hand it: + +- the paths of the captures, the `.diff.png` maps and the text report; +- the precise question, and the list of what it must find on each capture; +- the rule that what it cannot see is « not verified », never « absent »; +- the report's form: for each capture, compliant or not, and where each + defect sits; no general description; +- the order to change nothing. + +Never open a capture with your own Read tool, not even one: the paths go +to a fresh sub-agent, since one capture read stays in your context for +every later call. Launch a new sub-agent for each round, since one that saw +the old version sees what it expects. + +## The proofs at the review + +The proof files stay in the proofs folder. The pull request's description +links each one: for a changed screen, the before and the after side by +side, with the `.diff.png`. You write the paths unseen; the human looks. A +proof the depth asks for that the project has no command for is named +there as missing. + +## The depth record + +At the close, write the work document's `**Depth:**` line: the depth +chosen, the floor the diff computed and, above the floor, what the task +added and why. `retro` compares the two. diff --git a/socle/agents/skills/visual-proof/scripts/captures.ts b/socle/agents/skills/visual-proof/scripts/captures.ts new file mode 100644 index 0000000..92da044 --- /dev/null +++ b/socle/agents/skills/visual-proof/scripts/captures.ts @@ -0,0 +1,242 @@ +#!/usr/bin/env node +// SPDX-License-Identifier: MIT +// Copied into Chisel from the Harness (vault commit a05b1092), with Olympe's +// agreement of 21/11/2026, under Chisel's licence. A copy, not a link. +// captures : prendre les captures d'une page et dire, en texte, ce qui a changé. +// +// Pourquoi : une capture lue par l'outil Read reste dans le contexte de la session et se relit +// à chaque appel. Une session qui a lu 22 PNG (~10 Mo) a coûté près de 10 $. +// Ce script fait le travail mécanique sans modèle : +// les captures vont sur le disque, la comparaison avant/après se fait au pixel, et seul un +// rapport en texte revient. Regarder une image reste le travail d'un sous-agent +// (skill visual-proof), jamais du fil principal. +// +// Usage : +// node captures.ts --out [--largeurs 390,1280] [--avant ] [--plein] [--sombre] [--clic ]... [--json] +// --sombre : la page avec prefers-color-scheme: dark. --clic : clique cet élément avant la capture ; répétée, +// elle enchaîne les clics dans l'ordre (un menu ouvert, un onglet, un accordéon). Un sélecteur sans élément fait échouer la commande. +// Une page qui défile dans un conteneur interne se capture à la hauteur de la fenêtre : ce qui est +// sous le pli manque, et un sous-agent l'a déjà dit absent. Le rapport le signale ; --plein agrandit la fenêtre +// jusqu'à ce que le conteneur montre tout. +// Un conteneur qui défile de côté est signalé, avec ce qu'il cache. +// Playwright vient du repo où l'on se trouve (node_modules : playwright, playwright-core ou +// @playwright/test), sinon d'un playwright-core posé à côté de ce script. +// Si CHISEL_PLAYWRIGHT_WS est définie, le navigateur est celui du serveur Playwright qu'elle désigne : +// chromium.connect avec exposeNetwork '', qui lui montre le localhost de ce client. + +import { createRequire } from 'node:module'; +import { existsSync, mkdirSync, readdirSync, readFileSync, writeFileSync } from 'node:fs'; +import { homedir } from 'node:os'; +import { join } from 'node:path'; + +// cache : les px qui restent cachés dans un conteneur qui défile en hauteur ; cote : les conteneurs qui défilent de côté. +export type Shot = { chemin: string; largeur: number; fichier: string; hauteur: number; debord: number; erreurs: string[]; titre: string; cache?: number; cote?: string[]; clics?: string[] }; +export type Diff = { fichier: string; statut: 'identique' | 'change' | 'nouveau' | 'taille'; pixels?: number; part?: number; zone?: { x: number; y: number; l: number; h: number }; image?: string; avant?: [number, number]; apres?: [number, number] }; + +export function nomFichier(chemin: string, largeur: number): string { + const base = chemin === '/' || chemin === '' ? 'accueil' : chemin.replace(/[^a-zA-Z0-9-]+/g, '_').replace(/^_+|_+$/g, ''); + return `${base || 'page'}-${largeur}.png`; +} + +export function parseArgs(argv: string[]) { + const pos: string[] = []; + const o: { out?: string; largeurs: number[]; avant?: string; json: boolean; plein: boolean; sombre: boolean; clics: string[] } = { largeurs: [390, 1280], json: false, plein: false, sombre: false, clics: [] }; + for (let i = 0; i < argv.length; i++) { + const a = argv[i]; + if (a === '--out') o.out = argv[++i]; + else if (a === '--avant') o.avant = argv[++i]; + else if (a === '--largeurs') o.largeurs = argv[++i].split(',').map(Number); + else if (a === '--json') o.json = true; + else if (a === '--plein') o.plein = true; + else if (a === '--sombre') o.sombre = true; // prefers-color-scheme: dark ; sans, Chromium se dit en clair + else if (a === '--clic') { const sel = argv[++i]; if (!sel || sel.startsWith('--')) throw new Error('--clic : un sélecteur CSS est attendu'); o.clics.push(sel); } + else if (a.startsWith('-')) throw new Error(`option inconnue : ${a}\nusage : node captures.ts --out [--largeurs 390,1280] [--avant ] [--plein] [--sombre] [--clic ]... [--json]`); + else pos.push(a); + } + if (pos.length < 2 || !o.out) throw new Error('usage : node captures.ts --out [--largeurs 390,1280] [--avant ] [--plein] [--sombre] [--clic ]... [--json]'); + if (o.largeurs.some((n) => !Number.isInteger(n) || n < 200 || n > 4000)) throw new Error('--largeurs : des entiers entre 200 et 4000'); + return { base: pos[0].replace(/\/$/, ''), chemins: pos[1].split(',').map((c) => (c.startsWith('/') ? c : '/' + c)), ...o }; +} + +function chargerPlaywright(): any { + const essais = [process.cwd()]; + for (const dir of essais) { + const req = createRequire(join(dir, 'package.json')); + for (const nom of ['playwright', 'playwright-core', '@playwright/test']) { + try { return req(nom); } catch { /* suivant */ } + } + } + try { return createRequire(import.meta.url)('playwright-core'); } catch { /* introuvable */ } + throw new Error('Playwright introuvable : lance la commande depuis un repo qui l’a dans node_modules'); +} + +function chromeEnCache(): string | undefined { + const cache = join(homedir(), process.platform === 'darwin' ? 'Library/Caches/ms-playwright' : '.cache/ms-playwright'); + if (!existsSync(cache)) return undefined; + const dirs = readdirSync(cache).filter((d) => /^chromium-\d+$/.test(d)).sort((a, b) => Number(b.split('-')[1]) - Number(a.split('-')[1])); + for (const d of dirs) { + for (const exe of ['chrome-linux64/chrome', 'chrome-linux/chrome', 'chrome-mac/Chromium.app/Contents/MacOS/Chromium', 'chrome-mac-arm64/Google Chrome for Testing.app/Contents/MacOS/Google Chrome for Testing']) { + const p = join(cache, d, exe); + if (existsSync(p)) return p; + } + } + return undefined; +} + +// La voie du navigateur : le serveur Playwright commun si la variable est définie et non vide, sinon un Chromium local. +export function voieNavigateur(env: Record = process.env): { voie: 'distant'; ws: string } | { voie: 'local' } { + const ws = env.CHISEL_PLAYWRIGHT_WS?.trim(); + return ws ? { voie: 'distant', ws } : { voie: 'local' }; +} + +async function lancer(pw: any) { + const voie = voieNavigateur(); + if (voie.voie === 'distant') return await pw.chromium.connect(voie.ws, { exposeNetwork: '' }); + try { return await pw.chromium.launch(); } catch (e) { + const exe = chromeEnCache(); + if (!exe) throw e; + return await pw.chromium.launch({ executablePath: exe }); + } +} + +// Les conteneurs internes qui défilent (html et body exclus, que fullPage capture déjà) : la plus grande hauteur cachée, +// et ceux qui défilent de côté, nommés par balise, id et première classe. +function mesurer(): { cache: number; cote: string[] } { + let cache = 0; + const cote: string[] = []; + for (const e of Array.from(document.querySelectorAll('body *')) as HTMLElement[]) { + const st = getComputedStyle(e); + if (/(auto|scroll)/.test(st.overflowY) && e.scrollHeight > e.clientHeight + 1) cache = Math.max(cache, e.scrollHeight - e.clientHeight); + if (/(auto|scroll)/.test(st.overflowX) && e.scrollWidth > e.clientWidth + 1) { + const nom = e.tagName.toLowerCase() + (e.id ? '#' + e.id : '') + (e.classList[0] ? '.' + e.classList[0] : ''); + cote.push(`${nom} (${e.scrollWidth - e.clientWidth}px cachés)`); + } + } + return { cache, cote }; +} + +// La comparaison se fait dans le navigateur : il décode les PNG, sans dépendance. +async function comparer(page: any, avant: string, apres: string, sortie: string): Promise & { statut: Diff['statut'] }> { + const a = 'data:image/png;base64,' + readFileSync(avant).toString('base64'); + const b = 'data:image/png;base64,' + readFileSync(apres).toString('base64'); + const r = await page.evaluate(async ([a, b]: [string, string]) => { + const charger = (src: string) => new Promise((ok, ko) => { const i = new Image(); i.onload = () => ok(i); i.onerror = ko; i.src = src; }); + const [ia, ib] = await Promise.all([charger(a), charger(b)]); + const taille = ia.width !== ib.width || ia.height !== ib.height; + // Tailles différentes : on compare la zone commune, en haut à gauche. + const w = Math.min(ia.width, ib.width), h = Math.min(ia.height, ib.height); + const ctx = (img: HTMLImageElement) => { const c = document.createElement('canvas'); c.width = w; c.height = h; const x = c.getContext('2d')!; x.drawImage(img, 0, 0); return x.getImageData(0, 0, w, h); }; + const da = ctx(ia).data, db = ctx(ib).data; + const out = document.createElement('canvas'); out.width = w; out.height = h; + const ox = out.getContext('2d')!; const od = ox.createImageData(w, h); + let n = 0, x0 = w, y0 = h, x1 = -1, y1 = -1; + for (let i = 0; i < da.length; i += 4) { + const d = Math.abs(da[i] - db[i]) + Math.abs(da[i + 1] - db[i + 1]) + Math.abs(da[i + 2] - db[i + 2]); + const p = i / 4, x = p % w, y = (p / w) | 0; + if (d > 24) { + n++; if (x < x0) x0 = x; if (y < y0) y0 = y; if (x > x1) x1 = x; if (y > y1) y1 = y; + od.data[i] = 255; od.data[i + 1] = 0; od.data[i + 2] = 80; od.data[i + 3] = 255; + } else { const g = (db[i] + db[i + 1] + db[i + 2]) / 3; od.data[i] = od.data[i + 1] = od.data[i + 2] = 255 - (255 - g) * 0.25; od.data[i + 3] = 255; } + } + ox.putImageData(od, 0, 0); + return { taille, avant: [ia.width, ia.height], apres: [ib.width, ib.height], n, total: w * h, zone: n ? { x: x0, y: y0, l: x1 - x0 + 1, h: y1 - y0 + 1 } : undefined, png: n ? out.toDataURL('image/png') : undefined }; + }, [a, b]); + const tailles = r.taille ? { avant: r.avant, apres: r.apres } : {}; + if (!r.n) return { statut: r.taille ? 'taille' : 'identique', pixels: 0, part: 0, ...tailles }; + writeFileSync(sortie, Buffer.from(r.png.split(',')[1], 'base64')); + return { statut: r.taille ? 'taille' : 'change', ...tailles, pixels: r.n, part: Math.round((r.n / r.total) * 10000) / 100, zone: r.zone, image: sortie }; +} + +export async function capturer(o: ReturnType, pw = chargerPlaywright()) { + mkdirSync(o.out!, { recursive: true }); + const browser = await lancer(pw); + const shots: Shot[] = []; + const externes = new Set(); + const hote = new URL(o.base).hostname; + try { + for (const largeur of o.largeurs) { + const ctx = await browser.newContext({ viewport: { width: largeur, height: 900 }, reducedMotion: 'reduce', colorScheme: o.sombre ? 'dark' : 'light' }); + const page = await ctx.newPage(); + let erreurs: string[] = []; + page.on('pageerror', (e: Error) => erreurs.push(String(e.message).slice(0, 200))); + page.on('console', (m: any) => { if (m.type() === 'error') erreurs.push(String(m.text()).slice(0, 200)); }); + page.on('request', (r: any) => { try { const u = new URL(r.url()); if (/^https?:$/.test(u.protocol) && u.hostname !== hote) externes.add(u.origin); } catch { /* data: */ } }); + for (const chemin of o.chemins) { + erreurs = []; + await page.goto(o.base + chemin, { waitUntil: 'networkidle' }); + // Faire défiler pour déclencher le chargement paresseux, puis revenir en haut. + await page.evaluate(async () => { for (let y = 0; y < document.body.scrollHeight; y += 600) { window.scrollTo(0, y); await new Promise((r) => setTimeout(r, 30)); } window.scrollTo(0, 0); }); + await page.waitForTimeout(300); + // --plein : la fenêtre grandit de ce que cache le conteneur, jusqu'à ce qu'il montre tout (30 000 px au plus). + let haut = 900; + for (let i = 0; o.plein && i < 4; i++) { + const { cache } = await page.evaluate(mesurer); + if (cache <= 0 || haut >= 30_000) break; + haut = Math.min(30_000, haut + cache); + await page.setViewportSize({ width: largeur, height: haut }); + await page.waitForTimeout(300); + } + // --clic : les clics dans l'ordre, chacun suivi d'une courte pause pour que la page réagisse. + for (const sel of o.clics) { + try { await page.locator(sel).first().click({ timeout: 5000 }); } catch (e: any) { throw new Error(`--clic ${sel} sur ${chemin} à ${largeur}px : ${String(e.message).split('\n')[0]}`); } + await page.waitForTimeout(300); + } + const fichier = join(o.out!, nomFichier(chemin, largeur)); + await page.screenshot({ path: fichier, fullPage: true }); + const vu = await page.evaluate(mesurer); + if (haut !== 900) await page.setViewportSize({ width: largeur, height: 900 }); + const m = await page.evaluate(() => ({ debord: document.documentElement.scrollWidth - window.innerWidth, hauteur: document.documentElement.scrollHeight, titre: document.title })); + shots.push({ chemin, largeur, fichier, hauteur: Math.max(m.hauteur, haut), debord: Math.max(0, m.debord), erreurs: [...erreurs], titre: m.titre, cache: vu.cache, cote: vu.cote, ...(o.clics.length ? { clics: o.clics } : {}) }); + } + await ctx.close(); + } + const diffs: Diff[] = []; + if (o.avant) { + const page = await (await browser.newContext()).newPage(); + for (const s of shots) { + const nom = nomFichier(s.chemin, s.largeur); + const avant = join(o.avant, nom); + if (!existsSync(avant)) { diffs.push({ fichier: nom, statut: 'nouveau' }); continue; } + diffs.push({ fichier: nom, ...(await comparer(page, avant, s.fichier, join(o.out!, nom.replace(/\.png$/, '.diff.png')))) }); + } + } + return { shots, diffs, externes: [...externes] }; + } finally { + await browser.close(); + } +} + +export function rapport(r: Awaited>, plein = false): string { + const l: string[] = []; + l.push(`${r.shots.length} capture(s) :`); + for (const s of r.shots) { + const marques = [s.clics?.length ? `après clic : ${s.clics.join(' puis ')}` : '', s.debord ? `DÉBORDE de ${s.debord}px` : '', + s.cache ? `SOUS LE PLI : ${s.cache}px cachés dans un conteneur qui défile${plein ? '' : ', relance avec --plein'}` : '', + s.cote?.length ? `défile de côté : ${s.cote.join(', ')}` : '', + s.erreurs.length ? `${s.erreurs.length} erreur(s) : ${s.erreurs.join(' | ')}` : ''].filter(Boolean).join(' · '); + l.push(`- ${s.chemin} à ${s.largeur}px : ${s.fichier} (hauteur ${s.hauteur}px${s.titre ? `, « ${s.titre} »` : ''})${marques ? ' · ' + marques : ''}`); + } + if (r.diffs.length) { + l.push('', 'Avant/après :'); + for (const d of r.diffs) { + if (d.statut === 'identique') l.push(`- ${d.fichier} : identique`); + else if (d.statut === 'nouveau') l.push(`- ${d.fichier} : pas de capture avant`); + else { + const taille = d.statut === 'taille' ? `la taille change, ${d.avant!.join('×')} → ${d.apres!.join('×')} ; sur la zone commune, ` : ''; + l.push(`- ${d.fichier} : ${taille}${d.pixels ? `${d.part} % des pixels changent, dans la zone x ${d.zone!.x}, y ${d.zone!.y}, ${d.zone!.l}×${d.zone!.h} px · carte : ${d.image}` : 'rien ne change'}`); + } + } + } + l.push('', r.externes.length ? `Requêtes hors du site : ${r.externes.join(', ')}` : 'Aucune requête hors du site.'); + if (r.shots.some((s) => s.cache || s.cote?.length)) l.push('Ce qui est sous le pli ou caché de côté n\'est pas sur la capture : pour le sous-agent, « absent » y veut dire « non vérifié ».'); + l.push('Ne lis pas ces images dans ton fil : confie-les à un sous-agent (skill visual-proof).'); + return l.join('\n'); +} + +async function main() { + const o = parseArgs(process.argv.slice(2)); + const r = await capturer(o); + console.log(o.json ? JSON.stringify(r, null, 2) : rapport(r, o.plein)); +} + +if (import.meta.main) main().catch((e) => { console.error(`captures : ${String(e.message).slice(0, 400)}`); process.exit(1); }); diff --git a/socle/agents/synthesis.md.tpl b/socle/agents/synthesis.md.tpl new file mode 100644 index 0000000..2f35ef3 --- /dev/null +++ b/socle/agents/synthesis.md.tpl @@ -0,0 +1,26 @@ +# Synthesis — + + + +## What changed and why + + + +## Critical decisions + + + +## Data schema, before → after + + + +## Architecture change + + diff --git a/socle/agents/workflow.md b/socle/agents/workflow.md index d7c169f..59d4052 100644 --- a/socle/agents/workflow.md +++ b/socle/agents/workflow.md @@ -19,13 +19,14 @@ or a script. | Role | Who plays it | What it does | |---|---|---| | **Architect** | The agent a human, or an orchestrator, talks to. This is its default role. | Reads the task, writes or sharpens the spec, launches a Mason and talks with it, reads and corrects the plan, rules on what the Mason reports, brings the key questions to the human. | -| **Mason** | A sub-agent launched by the Architect. | Writes the plan in the work document and stops for the Architect's reading. Then launches a Typist to code it, runs `code-review`, and closes the task. | +| **Mason** | A sub-agent launched by the Architect. | Writes the plan in the work document and stops for the Architect's reading. Then launches a Typist to code it, runs `code-review`, and closes the task. Woken again after the close, it fixes the human review's comments. | | **Typist** | A sub-agent launched by the Mason once the plan is approved. | Types code from the approved plan and decides nothing, at a cheaper tier than the Mason's (`.agents/reference.md`, "Model tiers"). | | **Reviewers** | Sub-agents launched by the `code-review` skill. | Read the diff with no context from the session that wrote it. | **The human** owns the intent and the decisions that shape the task. The Architect approves the plan. A plan that departs from a decision the human -made goes back to the human, with the question stated. +made goes back to the human, with the question stated, except in one shot +("The one shot", below). The Architect's thread can be one long thread that compacts and serves as the entry point to a project, or one thread per piece of work. In a long @@ -38,74 +39,189 @@ skill or tool the tracker section of `.agents/project.md` names: an issue in a tracker, a line in beads, a spec document in the task workspace, or simply the message in the prompt. -**2. Write or sharpen the spec — Architect.** When the task arrives clear — -a well-written issue, a clear request — write the spec document from it, -with no interview: from the spec template declared in `.agents/project.md`, -named with the task id script, short, linking the issue rather than copying -it. When the intent is unclear, interview the human first with the -`grilling` skill, one question at a time, a recommended answer with each, -with `domain-modeling` underneath: new domain terms land in the glossary -and hard-to-reverse decisions in an ADR, where the glossary and decisions -section of `.agents/project.md` puts them. Either way the seams are named, and the sizing check is said out loud: the -task fits one pass, or it is cut into slices with the `slice-task` skill. -The human approves the spec when it carries decisions the task did not -state; otherwise the Architect moves it to `ready` itself. Commit the spec. -Status: `draft`, then `ready`. - -**3. Plan — Mason.** The Architect launches a Mason with the brief -below. The Mason reads the spec document and what it links to, creates -the work document beside it from the work template, and persists its -program design there: files, seam signatures, test order, the decisions the -spec left to the implementation. Then it stops and reports. No code before -the plan is approved. Status: `in-progress`, written by the Architect at -launch. +**2. Write or sharpen the spec — Architect.** When the task arrives clear — a +well-written issue, a clear request — write the spec document from it, with no +interview: from the spec template declared in `.agents/project.md`, named with +the task id script, short, linking the issue rather than copying it. When the +intent is unclear, interview the human first with the `grilling` skill, one +question at a time, a recommended answer with each, with `domain-modeling` +underneath: new domain terms land in the glossary and hard-to-reverse decisions +in an ADR, where the glossary and decisions section of `.agents/project.md` puts +them. When the interview tangles — each answer opens more questions than it +settles — switch to the `wayfinder` skill: a map of decision tickets, resolved +one at a time, whose destination is the spec. Either way the seams are named, +and the sizing check is said out loud: the task fits one pass, or it is cut into +slices with the `slice-task` skill. The spec carries a `**Review depth:**` line +when the task departs from the default of §J · Review of `.agents/project.md`. +The line gives `full` or `strategic`, then each proof the Architect asks for +after a `+` (`captures`, `recording`, `e2e`), as in `strategic + captures`. The +spec also carries a `**One shot:**` line when the Architect takes the one shot +("The one shot", below). The human approves the spec when it carries decisions +the task did not state, unless the task runs in one shot. In every other case +the Architect moves it to `ready` itself. Commit the spec. Status: `draft`, then +`ready`. + +**3. Plan — Mason.** The Architect launches a Mason with the brief below. The +Mason reads the spec document and what it links to, creates the work document +beside it from the work template, and persists its program design there: files, +seam signatures, test order, the decisions the spec left to the implementation, +and, when the task touches a screen, the screens and the proofs the +`visual-proof` skill asks for. Then it stops and reports. No code before the +plan is approved. Status: `in-progress`, written by the Architect at launch. **4. Read the plan — Architect.** Read the spec and the work document, nothing else. Correct the plan with the Mason, then approve it: the approval is written on the work document's `**Plan:**` line, with who and -when. A plan that departs from a decision the human made goes to the human -first. - -**5. Code — a Typist the Mason launches.** Once the plan is approved, -the Mason launches a Typist with the brief below. The Mason types -itself only a retouch of a few lines, or while the plan is not settled, and -writes which exception applies and why in the work document's worklog. The -Typist executes the approved plan in vertical steps, test-first at the -agreed seams (the `tdd` skill). Tick -the work document's checkboxes as work lands — they are the resume point — -and commit at each green step. Run the gate commands declared in -`.agents/project.md`. Reality that contradicts the plan is fixed in the -plan, in writing; reality that contradicts the spec is reported. +when, and the id the Mason's harness resumes it by. A plan that departs +from a decision the human made goes to the human first, except in one +shot. + +**5. Code — a Typist the Mason launches.** Once the plan is approved, the Mason +launches a Typist with the brief below. The Mason types itself only a retouch of +a few lines, or while the plan is not settled, and writes which exception +applies and why in the work document's worklog. The Typist executes the approved +plan in vertical steps, test-first at the agreed seams (the `tdd` skill). When +the task touches a screen, the before captures are taken before the first code +change, and the screen is checked once it is typed, as the `visual-proof` skill +says. Tick the work document's checkboxes as work lands — they are the resume +point — and commit at each green step. Run the gate commands declared in +`.agents/project.md`. Reality that contradicts the plan is fixed in the plan, in +writing; reality that contradicts the spec is reported. **6. Review — Mason.** Run the `code-review` skill on the full diff of the task. Its reviewers are fresh sub-agents that never saw the session that wrote the code — never skip this step, even for a small retouch. Write the findings in the work document; fix each one or answer it there. -**7. Close — Mason.** Tick the spec's acceptance criteria against -reality. Promote evergreen material into the living docs declared in -`.agents/project.md`, the glossary and the ADRs among them. Archive the spec and work documents together. Add the -dated journal entry. Run the `retro` skill and put its proposals in the -report. Stop everything you started — Docker containers, dev servers, -background processes — each by its own identifier (container name or id, -PID), and only those: never by pattern (`pkill -f`, `--all`), which stops -the work of others. Commit, update the tracker, and report to the -Architect: what landed, which criteria are met, what is left. Status: -`done`. +**7. Close — Mason.** Tick the spec's acceptance criteria against reality. When +the task touches a screen, take the after captures into the proofs folder of §J +· Review. Write the work document's `**Depth:**` line: the depth chosen, the +floor the diff computed with the `visual-proof` skill, and why the task went +above the floor when it did. Promote evergreen material into the living docs +declared in `.agents/project.md`, the glossary and the ADRs among them. Write +the synthesis from `.agents/synthesis.md.tpl`, beside the spec and named by +replacing `.spec.md` with `.synthesis.md`: it is the first reading of the human +review (step 8), so write it on the frontier tier. Archive the spec, work and +synthesis documents together. Add the dated journal entry. Run the `retro` skill +and put its proposals in the report. Stop everything you started — Docker +containers, dev servers, background processes — each by its own identifier +(container name or id, PID), and only those: never by pattern (`pkill -f`, +`--all`), which stops the work of others. This does not end the Mason itself: +its session is kept, so that the Architect can wake it at step 8, Human review, +to fix the comments. Commit, update the tracker, and report to the Architect: +what landed, which criteria are met, what is left. Status: `done`. **After the close — Architect.** Read the close report and rule on anything -left. Open the pull request. Merge and publish as the merge and publish -section of `.agents/project.md` says; by default, ask the human, whose -explicit word on that very action is the only go. +left. Open the pull request; in one shot, its description opens with the +spec's `**One shot:**` line, copied as is. Run the human review (step 8) on +it, unless that line skips the final review. Once the review is done or +skipped, merge and publish as the merge and publish section of +`.agents/project.md` says; by default, ask the human, whose explicit word +on that very action is the only go. In one shot with the final review, the +Architect says in so many words, as it hands the review, that approving it +is the word for the merge; the approval is then that word. + +**8. Human review — Architect.** The pull request is open and the +synthesis is committed in it. The human reads in three readings, in this +order, and may stop after the first. + +- **Strategic: the synthesis.** One article page at most, never one + sentence, written at step 7: what changed and why, the critical + decisions, the data schema before and after, any large architecture + change. The human may stop there with comments, and the review goes no + further. +- **Proofs: what the depth and the floor demand.** The captures, + recordings and e2e results the spec's depth line asks for, plus the + captures the floor adds when the diff touches a screen. They are read + after the synthesis and before the guide. They are files in the proofs + folder of §J · Review, committed with the work. The pull request's + description links each one, with a before → after pair for each changed + screen. The human looks at them himself. A kind of proof the project has + no command for is named there as missing. +- **Reading guide: the crit story.** The Architect writes it with + `crit story --guide` and the project's guide, on the PR diff. Its first + chapter holds only the synthesis file's hunk, and its prologue says to + read that first and that the review may stop there. The code chapters + come last. + +How far the human goes is the spec's `**Review depth:**` line, or §J · +Review of `.agents/project.md` when the spec has none. `strategic` is the +synthesis plus the proofs; `full` goes down to the reading guide. The diff +stays a floor: `strategic` never skips the proofs, and a screen touched +brings captures whatever the line says. + +The base is read from the pull request, never assumed to be `main`: +`gh pr view --json number,baseRefName`. The story is prepared and +ingested with `--pr --base-branch `, and the wait is +`crit --pr --base-branch `, run in the background. Without a +forge pull request, review the branch diff with `--base-branch `, +where the base is the branch the work was cut from. + +The Architect waits for the human and answers every comment. No question +goes into crit: questions go to the human, in conversation. An expired +wait is not a blocker: re-run the same crit command, or `crit --session +`, and wait again. Only another failure is a blocker. If `crit` is not +installed, say where to get it (https://crit.md, then `crit install +`) and stop for the human. + +**Who fixes the comments.** A comment that asks for a change goes to the +task's Mason, the one that planned, coded and closed it. The Architect +wakes it in its own session, however long ago it closed: waking it costs +as much as a fresh one, but it holds the whole context. A fresh Mason only +when that session is lost; it starts from the spec, work and synthesis +documents, where step 7 archived them. A comment that changes a decision +of the spec: the Architect writes the new decision into the spec first, +then wakes the same Mason on it. The Mason fixes as it fixes a review +finding: through a Typist unless the fix is a retouch of a few lines, the +gate commands, `code-review` on the fix's diff, each comment written in +the work document with its fix or its answer, the synthesis amended when a +critical decision moved. It commits on the pull request's branch and +reports to the Architect, who answers the comment in crit and waits again. +The status stays `done`: the review is of a pull request, not a status. + +The review ends when the human approves, or when every comment is answered +and addressed. Merging then follows "After the close", above. + +## The one shot + +A task can run in **one shot**: the human's only possible stop is the final +review, and the spec says whether it happens. The Architect takes the one +shot at step 2 when it judges the task small, or when the human asks for +it. A human who asks for the full lane always gets it. There is no project +switch: the lane is chosen task by task. + +The Architect writes the choice in one line of the spec, directly under its +`**Status:**` line, or under `**Review depth:**` when the spec has one: + + **One shot:** ; final review kept + +`` is the reason: the task is small, or the human asked for it. The +line ends in `final review skipped` when there is no final review. The +pull request repeats it. + +What the one shot skips: the human's reading of the spec, which the +Architect approves itself even when it carries decisions the task did not +state, and every stop that only serves a human reading after it; "Where the +work stops" says which. What it keeps: the plan and the Architect's reading +of it, the Typist, the code review and its fresh reviewers, the gate +commands, the close and its synthesis, and the pull request. When the line +keeps the final review, it runs as step 8 says, at the spec's depth. A plan +that departs from the human's decisions is the Architect's to rule on: it +writes the ruling on the `**Plan:**` line, and the synthesis names it among +the critical decisions. ## Where the work stops -| Who stops | For whom | When | -|---|---|---| -| Mason | Architect | After the plan; after the close, with its report; on a blocker it cannot rule on | -| Typist | Mason | After its part of the plan; on anything the plan does not answer | -| Architect | Human | On an unclear intent; on a spec that carries decisions the task did not state; on a plan that departs from the human's decisions; on a blocker above what it owns | -| Architect | Human | Before a merge or a publish, unless the project lets the agent do it | +| Who stops | For whom | When | In one shot | +|---|---|---|---| +| Mason | Architect | After the plan; after the close, with its report; after fixing the human review's comments; on a blocker it cannot rule on | Kept; no comments to fix when the final review is skipped | +| Typist | Mason | After its part of the plan; on anything the plan does not answer | Kept | +| Architect | Human | On an unclear intent | Kept: the intent is settled before the lane is chosen | +| Architect | Human | On a spec that carries decisions the task did not state | Removed: the Architect approves the spec | +| Architect | Human | On a plan that departs from the human's decisions | Removed: the Architect rules, and the synthesis says so | +| Architect | Human | On a blocker above what it owns | Kept | +| Architect | Human | At the human review, waiting for the human's reading of the pull request | Only when the spec's `**One shot:**` line keeps the final review | +| Architect | Human | Before a merge or a publish, unless the project lets the agent do it | With the final review, its approval is the word for the merge; without it, kept | Everything else runs without a stop. A question that is not one of these is the Architect's to settle. @@ -151,9 +267,9 @@ write. Three earn it: A brief is artifacts and paths, never the conversation: whatever the sub-agent needs must already be in the repo. Reviewers are always fresh. A -Mason is reused within a live thread — the one that wrote the plan -launches its Typist and runs the review — and a resumed task starts fresh -from the spec and work documents. +Mason is kept for its whole task: the one that wrote the plan launches its +Typist, runs the review, closes, and fixes the human review's comments. +"Who fixes the comments", in step 8, says when a fresh one replaces it. A sub-agent does not inherit the repo's or the runtime's rules, only its brief, so every brief below also carries these: @@ -178,7 +294,8 @@ What the Architect writes when it launches a Mason: - the branch to work on, and how to commit (explicit paths, no push); - the gate commands; - the steps it owns: plan, then stop for the reading; code, through a - Typist; `code-review`; close; + Typist; `code-review`; close; then, when woken, the human review's + comments; - the model tiers, resolved to concrete models (`.agents/reference.md`, "Model tiers"): the Mason's own, which the Architect **names explicitly when it launches the Mason**, and the Typist's, for the Mason to name @@ -186,6 +303,8 @@ What the Architect writes when it launches a Mason: launcher's; - what it reports at each stop: the plan in a few lines and its questions; at the close, the commits, the criteria met or not, and what is left; + after the comments, the commits and how each comment was fixed or + answered; - two reports, so the first must not be lost: the plan report is written in the work document before it is sent. diff --git a/socle/intentions/unreleased/human-review-step.md b/socle/intentions/unreleased/human-review-step.md new file mode 100644 index 0000000..0aaaf01 --- /dev/null +++ b/socle/intentions/unreleased/human-review-step.md @@ -0,0 +1,66 @@ +--- +id: unreleased/human-review-step +classification: informational +--- + +# The workflow gains a human review of the pull request + +## Goal + +The human knows that `.agents/workflow.md` now has a step 8, the human +review, that the close writes a synthesis from a new template, and that the +review runs in crit. + +## Why + +A pull request was reviewed from its raw diff, whatever its size. The +workflow now asks the Mason for a one-page synthesis at the close, and the +Architect opens the review on it: the human reads the synthesis, then the +proofs, then the reading guide, and may stop after the first. Without +knowing it, a team keeps reviewing diffs the old way, and does not know +crit must be installed on the machine that runs the review. + +## Applies When + +- The repo is updated from a version whose `.agents/workflow.md` has no + step 8, "Human review". + +## Do Not Apply When + +- Never: there is nothing to apply. `workflow.md` and the synthesis + template are managed files and the copy `chisel update` makes carries the + change; the session only reads it to the human. + +## Observable Gaps + +1. **What the human knows.** Signal: none in the repo. Say it to the + human in a few sentences: the close writes a synthesis from + `.agents/synthesis.md.tpl`, on the frontier tier; step 8 has the human + read it first, then the proofs, then the reading guide; a spec may carry + a `**Review depth:**` line, `full` or `strategic`, as the spec template + now shows; and `crit` (https://crit.md) must be installed on the machine + that runs the review. A team whose own steps say otherwise reconciles + them itself. + Done when: the human has read it. + +## Out of Scope + +- The review section of `.agents/project.md`: its own intention, + `unreleased/review-section`, adds it. +- The project's own instructions outside the chisel markers of + `AGENTS.md`. + +## Reference Paths + +- `.agents/workflow.md` — **copy**, by the update. +- `.agents/synthesis.md.tpl` — **copy**, by the update. +- `project-management/000-template.spec.md` — **copy**, by the update. + +## Validation + +- Nothing to check in the repo: the closing update carries the change. + +## Record Result + +The closing `chisel update` records it, with the other informational +intentions. diff --git a/socle/intentions/unreleased/mason-fixes-the-comments.md b/socle/intentions/unreleased/mason-fixes-the-comments.md new file mode 100644 index 0000000..1386075 --- /dev/null +++ b/socle/intentions/unreleased/mason-fixes-the-comments.md @@ -0,0 +1,59 @@ +--- +id: unreleased/mason-fixes-the-comments +classification: informational +--- + +# The task's Mason fixes the human review's comments + +## Goal + +The human knows that the task's Mason fixes the comments of the human +review, and that its session is kept after the close. + +## Why + +Waking the same Mason costs as much as a fresh one, and it carries the +whole context of the task: the plan, the decisions, the findings. A team +that discards its Masons at the close, or starts a fresh one on the +comments, loses that context and pays to rebuild it from the documents. + +## Applies When + +- The repo is updated from a version whose `.agents/workflow.md` step 8, + "Human review", has no "Who fixes the comments" paragraph. + +## Do Not Apply When + +- Never: there is nothing to apply. `workflow.md` is a managed file and + the copy `chisel update` makes carries the change; the session only + reads it to the human. + +## Observable Gaps + +1. **What the human knows.** Signal: none in the repo. Say it to the + human in a few sentences: a comment of the human review that asks for a + change goes to the task's Mason, woken in its own session however long + ago it closed; the close no longer ends that session, and step 4 + writes the id the Mason's harness resumes it by on the `**Plan:**` line + so the Architect can find it again; a fresh Mason starts from the + spec, work and synthesis documents only when the session is lost. A + team whose own steps say otherwise reconciles them itself. + Done when: the human has read it. + +## Out of Scope + +- The project's own instructions outside the chisel markers of + `AGENTS.md`: a project that says otherwise reconciles itself. + +## Reference Paths + +- `.agents/workflow.md` — **copy**, by the update. + +## Validation + +- Nothing to check in the repo: the closing update carries the change. + +## Record Result + +The closing `chisel update` records it, with the other informational +intentions. diff --git a/socle/intentions/unreleased/one-shot.md b/socle/intentions/unreleased/one-shot.md new file mode 100644 index 0000000..bfec582 --- /dev/null +++ b/socle/intentions/unreleased/one-shot.md @@ -0,0 +1,71 @@ +--- +id: unreleased/one-shot +classification: informational +--- + +# A task can run in one shot + +## Goal + +The human knows that a task can run in one shot, with the final review as +its only possible human stop, and that the word "one-shot" of the old +glossary is now "quick fix". + +## Why + +Small tasks went through every human stop of the workflow, the spec +reading first. The one shot lets the Architect take a small task, or one +the human asks for, from the spec to the pull request with no stop but +the final review, and that one only when the spec keeps it. The code +review, the gates and the pull request still run. A team that does not +know it keeps reading specs it did not need to read, and reads "one-shot" +in the old sense where the workflow now means the lane. + +## Applies When + +- The repo is updated from a version whose `.agents/workflow.md` has no + section "The one shot". + +## Do Not Apply When + +- Never: there is nothing to apply. `workflow.md`, `reference.md`, + `discipline.md` and `methodology.md` are managed files and the copy + `chisel update` makes carries the change; the session only reads it to + the human. + +## Observable Gaps + +1. **What the human knows.** Signal: none in the repo. Say it to the + human in a few sentences: the Architect takes the one shot when it + writes the spec, if it judges the task small or the human asks, and + writes a `**One shot:**` line in the spec, with its reason and whether + the final review is kept or skipped; the pull request repeats it; a + human who asks for the full lane always gets it, and no project setting + switches it on. With the final review, approving it is the word for the + merge, and the Architect says so when it hands the review; without it, + the merge goes as the glue's merge and publish section says. The spec + interview now switches from `grilling` to `wayfinder` when it tangles. + Work done without a task artifact is now called a quick fix. + Done when: the human has read it. + +## Out of Scope + +- The project's own instructions outside the chisel markers of + `AGENTS.md`, which may still say "one-shot" in the old sense: a project + that does reconciles itself. + +## Reference Paths + +- `.agents/workflow.md` — **copy**, by the update. +- `.agents/reference.md` — **copy**, by the update. +- `.agents/discipline.md` — **copy**, by the update. +- `.agents/methodology.md` — **copy**, by the update. + +## Validation + +- Nothing to check in the repo: the closing update carries the change. + +## Record Result + +The closing `chisel update` records it, with the other informational +intentions. diff --git a/socle/intentions/unreleased/review-proofs.md b/socle/intentions/unreleased/review-proofs.md new file mode 100644 index 0000000..55faf37 --- /dev/null +++ b/socle/intentions/unreleased/review-proofs.md @@ -0,0 +1,64 @@ +--- +id: unreleased/review-proofs +classification: migration +--- + +# The glue names the commands that prove a screen + +## Goal + +The "J · Review" section of `.agents/project.md` declares the project's +e2e, recording and screenshot commands, each optional, and the folder the +proofs go in. + +## Why + +When a task touches a screen, the agent checks it itself, and the human +review shows the proof: at least a capture, before → after when the screen +existed. The workflow and the `visual-proof` skill read the commands in +the glue. When a command is left at none, the task has no proof of that +kind and the review says so, instead of guessing a command. + +## Applies When + +- `.agents/project.md` has a "J · Review" section without one of the + lines `E2E command`, `Recording command`, `Screenshot command` or + `Proofs folder`. + +## Do Not Apply When + +- The glue has no "J · Review" section. The intention that adds the + section comes first, and this one applies after it. + +## Observable Gaps + +1. **The command lines.** Signal: §J lacks one of the three command + lines. Ask the commands question of the setup skill, and write each + answer on its line. For an answer of none, write the reference's line + as it stands. + Done when: §J has the three command lines. +2. **The proofs folder.** Signal: §J has no `Proofs folder` line. Write + the reference's line, unless the human names another folder. + Done when: the line exists. + +## Out of Scope + +- The `Default depth` line. +- Taking any proof. + +## Reference Paths + +- `.agents/project.md` — **adapt**: the section of the reference, with + the project's answers. +- `.agents/skills/chisel-setup/SKILL.md` — **copy**: the question. + +## Validation + +- The `## J · Review` section of `.agents/project.md` has the lines + `E2E command`, `Recording command`, `Screenshot command` and + `Proofs folder`. + +## Record Result + +`chisel record unreleased/review-proofs --applied`, or +`--skipped ""` after the human's word. diff --git a/socle/intentions/unreleased/review-section.md b/socle/intentions/unreleased/review-section.md new file mode 100644 index 0000000..edf4dd7 --- /dev/null +++ b/socle/intentions/unreleased/review-section.md @@ -0,0 +1,56 @@ +--- +id: unreleased/review-section +classification: migration +--- + +# The glue says how far the human review goes + +## Goal + +The glue, `.agents/project.md`, has a "J · Review" section that gives the +default depth of the human review: `full` or `strategic`. + +## Why + +The workflow's step 8, the human review, reads the default depth from the +glue when a spec carries no depth line of its own. A glue without the +section leaves the step without a default; writing it down lets the project +choose, and lets every agent read the choice in one place. + +## Applies When + +- `.agents/project.md` has no "J · Review" section. + +## Do Not Apply When + +- The repo has no `.agents/project.md`: the baseline intention writes one. + +## Observable Gaps + +1. **The section.** Signal: no "J · Review" heading. Ask the review + question of the setup skill, and add the section with the answer, at the + end of the glue, with a `Default depth` line. Without an answer, write + the default: `full`. + Done when: the section exists and its `Default depth` line is `full` or + `strategic`. + +## Out of Scope + +- The glue's other sections. +- Running a review. + +## Reference Paths + +- `.agents/project.md` — **adapt**: the section of the reference, with + the project's answer. +- `.agents/skills/chisel-setup/SKILL.md` — **copy**: the question. + +## Validation + +- `.agents/project.md` has a `## J · Review` section with a + `Default depth` line. + +## Record Result + +`chisel record unreleased/review-section --applied`, or +`--skipped ""` after the human's word. diff --git a/socle/intentions/unreleased/visual-proof.md b/socle/intentions/unreleased/visual-proof.md new file mode 100644 index 0000000..1d2da33 --- /dev/null +++ b/socle/intentions/unreleased/visual-proof.md @@ -0,0 +1,77 @@ +--- +id: unreleased/visual-proof +classification: informational +--- + +# A screen touched is proved, and the proof is shown + +## Goal + +The human knows how a task that touches a screen is now proved. It gets +captures, before → after, from the capture command that ships with the +`visual-proof` skill. The agent checks the screen itself, and never reads +a capture in its own thread. The spec's depth line can ask for proofs. +The close records the depth chosen and the floor, and `retro` compares +them. + +## Why + +A human review that shows only code never shows the screen a user will +see. And an agent that reads its own captures pays for every image again +at each call: one session read 22 of them for about ten dollars. The +capture command compares at the pixel and answers in text; when an image +must be looked at, a fresh sub-agent does it, and the human sees the images +himself. Recording the depth against the floor shows an Architect who +always asks for more than the diff needs. + +## Applies When + +- The repo is updated from a version with no `visual-proof` skill. + +## Do Not Apply When + +- Never: there is nothing to apply. The skill, its capture command, the + workflow and the templates are managed files, and the copy that + `chisel update` makes carries the change. The session only reads it to + the human. + +## Observable Gaps + +1. **What the human knows.** Signal: none in the repo. Say it to the + human in a few sentences: + - The capture command is + `node .agents/skills/visual-proof/scripts/captures.ts`. It needs Node + 24.2 or later, and Playwright in the project's own dependencies. + `CHISEL_PLAYWRIGHT_WS` can name a remote Playwright server. + - A screen touched always brings captures. The spec's + `**Review depth:**` line can ask for more after a `+`: `captures`, + `recording`, `e2e`. + - The proofs are files in the folder §J names, linked from the pull + request's description. + - The work document's `**Depth:**` line records the depth chosen + against the floor, and `retro` reads it. + + Done when: the human has read it. + +## Out of Scope + +- The commands of §J, which the migration intention on the review's + commands asks for. +- A page that shows the proofs; for now they are files. + +## Reference Paths + +- `.agents/skills/visual-proof/SKILL.md` — **copy**, by the update. +- `.agents/skills/visual-proof/scripts/captures.ts` — **copy**, by the + update. +- `.agents/workflow.md` — **copy**, by the update. +- `.agents/skills/retro/SKILL.md` — **copy**, by the update. + +## Validation + +- Nothing to check in the repo: the closing update carries the change. + +## Record Result + +The closing `chisel update` records it, with the other informational +intentions. diff --git a/socle/templates/000-template.spec.md b/socle/templates/000-template.spec.md index ccf219f..bcf091f 100644 --- a/socle/templates/000-template.spec.md +++ b/socle/templates/000-template.spec.md @@ -75,6 +75,7 @@ All spec documents MUST follow this structure: # **Status:** draft +**Review depth:** full | strategic [+ captures] [+ recording] [+ e2e] --- @@ -169,6 +170,18 @@ the `**Status:**` line: - **When a tracker holds the status**, the line says so — `**Status:** tracked as ` — and the status lives in the tracker only. +## Review depth + +The `**Review depth:**` line says how far down the human goes at the human +review, and which proofs the Architect asks for. It starts with one of the +two depths that step 8 of [workflow.md](/.agents/workflow.md) defines. +Each proof wanted follows after a `+`: `captures`, `recording`, `e2e`, as +in `strategic + captures`. The diff only adds a floor: a screen touched +brings captures even when the line leaves them out (the `visual-proof` +skill). Keep what the task needs. Or delete the line: the review section +of `.agents/project.md` then gives the default depth, and the only proofs +are the floor's. + ## When Creating New Tasks 1. Interview first when the intent is unclear; write from the task when it is clear. diff --git a/socle/templates/000-template.work.md b/socle/templates/000-template.work.md index f1bebf0..c990c9a 100644 --- a/socle/templates/000-template.work.md +++ b/socle/templates/000-template.work.md @@ -33,6 +33,11 @@ own — only its slices do. the Mason, then the approval goes on the `**Plan:**` line. Plan approval is that line, not a status. +**The close records the depth.** At the close the Mason writes the +`**Depth:**` line: the depth the spec chose, the floor the diff computed +with the `visual-proof` skill, and why the task went above the floor when +it did. The `retro` skill compares the two across tasks. + **The review writes into it.** `code-review` reports its findings, and the Mason records each one in the Diff-Review Findings section with its fix or its answer. @@ -50,6 +55,11 @@ Created by the Mason at the plan step, . Spec: **Plan:** waiting for the Architect's reading. +**Depth:** written at the close. + + ## Program Design Written at the plan step, from the spec's system design. Decisions, not diff --git a/src/install.ts b/src/install.ts index afdc54f..93466f9 100644 --- a/src/install.ts +++ b/src/install.ts @@ -42,6 +42,7 @@ const COPIED_FILES: ReadonlyArray = [ // package and no network. `init` never writes `.agents/user.md`: a shared // installer has no business creating a personal, gitignored file. [SOCLE.userMdTemplate, ".agents/user.md.tpl"], + [SOCLE.synthesisTemplate, ".agents/synthesis.md.tpl"], [SOCLE.specTemplate, "project-management/000-template.spec.md"], [SOCLE.workTemplate, "project-management/000-template.work.md"], ]; diff --git a/src/paths.ts b/src/paths.ts index a7149d8..5c59daa 100644 --- a/src/paths.ts +++ b/src/paths.ts @@ -71,6 +71,7 @@ export const SOCLE = { taskIdScript: "socle/scripts/task-id.sh", projectMdTemplate: "socle/agents/project.md.tpl", userMdTemplate: "socle/agents/user.md.tpl", + synthesisTemplate: "socle/agents/synthesis.md.tpl", discipline: "socle/agents/discipline.md", methodology: "socle/agents/methodology.md", reference: "socle/agents/reference.md", diff --git a/src/socle-files.ts b/src/socle-files.ts index 7d5acc7..3694000 100644 --- a/src/socle-files.ts +++ b/src/socle-files.ts @@ -36,9 +36,12 @@ export const SOCLE_FILES: readonly string[] = [ "agents/skills/tdd/SKILL.md", "agents/skills/tdd/mocking.md", "agents/skills/tdd/tests.md", + "agents/skills/visual-proof/SKILL.md", + "agents/skills/visual-proof/scripts/captures.ts", "agents/skills/wayfinder/SKILL.md", "agents/skills/writing-great-skills/GLOSSARY.md", "agents/skills/writing-great-skills/SKILL.md", + "agents/synthesis.md.tpl", "agents/user.md.tpl", "agents/workflow.md", "intentions/0.2.0/01-workflow-replaces-formulas.md", @@ -57,6 +60,12 @@ export const SOCLE_FILES: readonly string[] = [ "intentions/unreleased/sub-agent-briefs-carry-runtime-rules.md", "intentions/TEMPLATE.md", "intentions/baseline.md", + "intentions/unreleased/human-review-step.md", + "intentions/unreleased/mason-fixes-the-comments.md", + "intentions/unreleased/one-shot.md", + "intentions/unreleased/review-proofs.md", + "intentions/unreleased/review-section.md", + "intentions/unreleased/visual-proof.md", "scripts/sync-upstream.sh", "scripts/sync-upstream/SKILL.md", "scripts/task-id.sh", diff --git a/test/TESTS.md b/test/TESTS.md index 987e801..fa372b9 100644 --- a/test/TESTS.md +++ b/test/TESTS.md @@ -20,7 +20,7 @@ formatting. Both tasks are green before a commit. | Group | What it protects | What a failure means | |---|---|---| -| `init` | Every socle file lands in a repo that predates chisel (tree matches `test/fixtures/golden-tree.txt`), user content survives verbatim, the rendered managed block matches the source template, and an import appended to a file with no trailing newline still gets its own line. | The installer stopped shipping a file, damaged a repo it does not own, or drifted from its own template. | +| `init` | Every socle file lands in a repo that predates chisel (tree matches `test/fixtures/golden-tree.txt`), user content survives verbatim, the rendered managed block matches the source template, and an import appended to a file with no trailing newline still gets its own line; the synthesis template is installed and the glue carries §J · Review, with its default depth, its three proof commands and its proofs folder. | The installer stopped shipping a file, damaged a repo it does not own, or drifted from its own template. | | `arrange` | A first `init` (no manifest) takes an inventory: OpenSpec, Spec Kit (`.specify/` or a `specs//` with its plan or tasks), a task folder holding a file, decision records, a `CONTEXT.md`, another agent's rules, an `AGENTS.md` with text beyond its title or a `CLAUDE.md` with more than the import, `.beads/`, the first chisel version, a linked path. On any of them it stages `.chisel-workspace/` with an install session and the reference tree, names each kind and path and the setup skill, writes nothing else and exits 3; a repo with none of them, or with a manifest, installs and exits 0; an existing workspace makes `init`, `--arranged` included, refuse; `--arranged` skips the inventory and still refuses a linked path. Tests install the fixtures with `--arranged`. | A first install started talking over a method the repo already had, or staging a repo that had nothing to arrange. | | `idempotence` | Running `init` again changes nothing: no second managed block, a §E line a human unticked stays unticked, and every file hashes the same. | `init` is no longer safe to re-run — and it runs again on every version bump. | | `boilerplate` | A repo with no `AGENTS.md` gets exactly the golden tree too. | Two equipped repos would drift apart from day one. | @@ -35,6 +35,7 @@ formatting. Both tasks are green before a commit. | `release-check` | Chisel's own release checks: a pull request that changes `socle/` outside `socle/intentions/` fails the gate unless it adds an `unreleased/` intention, naming the paths and the `no-intention` label; the Release PR fails `promoted` while an intention is left unreleased or missing from the version's folder under its rewritten id, naming the promote command; `publish` refuses a tag that is not `deno.json`'s version or an intention left unreleased; `notes` lists the release's intentions, or says it ships none. | A socle change could ship without telling repos what to do, or a release could be tagged and published with its intentions unpromoted. | | `commit-lint` | Every commit is conventional: a header with a known type and scope, in lower case, without a full stop, short enough, a blank line before the body; git's own merge and fixup messages pass; a pull request's range is linted except the history before the rule, and an exempt commit the clone does not know exempts nothing; a pull request's title and description (which become the squash commit) refuse a WIP word, an image, a task list, `BREAKING-CHANGE:` and an empty description outside a draft; the hook installer writes an executable hook and never replaces one it did not write. | release-please would read a commit it cannot classify, pick the wrong version or write a changelog line nobody meant. | | `usage` | `--help` names the commands, `record` among them, the exit codes, 3 among them, and the prerequisite; `--version` prints what the package declares; an unknown command and an argument too many exit 2 naming the offender. | The command line lies about itself, or a typo passes for a command. | +| `captures` | The capture command the `visual-proof` skill ships is the copy agreed with its author, made generic: no search under `~/projects`, no Harness variable or name, no vault path. Under Node 24.2 or later, a missing argument is a usage error under its own name, and `CHISEL_PLAYWRIGHT_WS` selects the remote browser. When `CHISEL_TEST_PLAYWRIGHT` names a `playwright-core` directory, a page served twice gives its capture, a `change` verdict with a `.diff.png`, then an `identique` verdict in the text report. Without Node or Playwright, those tests are skipped. | The copy took back a machine-specific path or name, or the command stopped capturing, comparing or reporting. | ## Two standing rules diff --git a/test/captures.test.ts b/test/captures.test.ts new file mode 100644 index 0000000..9639556 --- /dev/null +++ b/test/captures.test.ts @@ -0,0 +1,190 @@ +// The capture command of the visual-proof skill: a copy of another project's +// script, run by Node, never imported into Deno. The text checks always run; +// the Node checks run when Node 24.2 or later is there; the browser check +// runs only when CHISEL_TEST_PLAYWRIGHT names a playwright-core directory. + +import { + assert, + assertEquals, + assertMatch, + assertStringIncludes, +} from "@std/assert"; +import { join, toFileUrl } from "@std/path"; +import { REPO_ROOT } from "./helpers.ts"; + +const SCRIPT = join( + REPO_ROOT, + "socle", + "agents", + "skills", + "visual-proof", + "scripts", + "captures.ts", +); + +function recentNode(): boolean { + try { + const out = new Deno.Command("node", { + args: ["--version"], + stdout: "piped", + stderr: "null", + }).outputSync(); + if (!out.success) return false; + const [major, minor] = new TextDecoder().decode(out.stdout).trim() + .replace(/^v/, "").split(".").map(Number); + return major > 24 || (major === 24 && minor >= 2); + } catch { + return false; + } +} + +const NODE = recentNode(); +const PLAYWRIGHT = Deno.env.get("CHISEL_TEST_PLAYWRIGHT"); + +async function node( + args: string[], + cwd?: string, +): Promise<{ code: number; stdout: string; stderr: string }> { + const out = await new Deno.Command("node", { + args, + cwd, + stdout: "piped", + stderr: "piped", + }).output(); + const decode = (bytes: Uint8Array) => new TextDecoder().decode(bytes); + return { + code: out.code, + stdout: decode(out.stdout), + stderr: decode(out.stderr), + }; +} + +Deno.test("captures: the copy carries nothing of the machines it came from", async () => { + const text = await Deno.readTextFile(SCRIPT); + assert(!/['"]projects['"]/.test(text), "no search under ~/projects"); + assert(!text.includes("HARNESS_PLAYWRIGHT_WS"), "the variable is renamed"); + assertStringIncludes(text, "CHISEL_PLAYWRIGHT_WS"); + assert(!/harness captures/i.test(text), "no « harness captures »"); + assert( + !text.includes("ContainersData") && !text.includes("obsidian"), + "no vault path", + ); + assert( + !/Pierrick|lot3-|sujet captures-/.test(text), + "no private name or topic of the machines it came from", + ); +}); + +Deno.test({ + name: "captures: a missing argument is a usage error under its own name", + ignore: !NODE, + async fn() { + const result = await node([SCRIPT]); + assertEquals(result.code, 1, result.stderr); + assertMatch(result.stderr, /^captures : usage : node captures\.ts /); + }, +}); + +Deno.test({ + name: "captures: CHISEL_PLAYWRIGHT_WS names the remote browser", + ignore: !NODE, + async fn() { + const probe = `import { voieNavigateur } from ${ + JSON.stringify(toFileUrl(SCRIPT).href) + }; +console.log(JSON.stringify([ + voieNavigateur({ CHISEL_PLAYWRIGHT_WS: "ws://pw:3000" }), + voieNavigateur({ HARNESS_PLAYWRIGHT_WS: "ws://pw:3000" }), +]));`; + const result = await node(["--input-type=module", "-e", probe]); + assertEquals(result.code, 0, result.stderr); + assertEquals(JSON.parse(result.stdout), [ + { voie: "distant", ws: "ws://pw:3000" }, + { voie: "local" }, + ]); + }, +}); + +function page(title: string, colour: string): string { + return `${title}` + + `

${title}

`; +} + +Deno.test({ + name: + "captures: a page captured twice gives the captures, a diff map and a report", + ignore: !NODE || !PLAYWRIGHT, + async fn() { + const work = await Deno.makeTempDir({ prefix: "chisel-captures-" }); + try { + await Deno.mkdir(join(work, "node_modules")); + await Deno.symlink( + PLAYWRIGHT!, + join(work, "node_modules", "playwright-core"), + ); + let body = page("Before", "#ffffff"); + const stop = new AbortController(); + const server = Deno.serve( + { hostname: "127.0.0.1", port: 0, signal: stop.signal, onListen() {} }, + () => + new Response(body, { + headers: { "content-type": "text/html; charset=utf-8" }, + }), + ); + const base = `http://127.0.0.1:${server.addr.port}`; + const capture = (out: string, ...more: string[]) => + node( + [ + SCRIPT, + base, + "/", + "--out", + join(work, out), + "--largeurs", + "390", + ...more, + ], + work, + ); + try { + const before = await capture("before", "--json"); + assertEquals(before.code, 0, before.stderr); + assert( + (await Deno.stat(join(work, "before", "accueil-390.png"))).isFile, + "the first run writes the capture", + ); + + body = page("After", "#ffcc00"); + const after = await capture( + "after", + "--avant", + join(work, "before"), + "--json", + ); + assertEquals(after.code, 0, after.stderr); + const report = JSON.parse(after.stdout) as { + diffs: { fichier: string; statut: string }[]; + }; + assertEquals( + report.diffs.map((d) => [d.fichier, d.statut]), + [["accueil-390.png", "change"]], + ); + assert( + (await Deno.stat(join(work, "after", "accueil-390.diff.png"))) + .isFile, + "a changed screen gets its diff map", + ); + + const again = await capture("again", "--avant", join(work, "after")); + assertEquals(again.code, 0, again.stderr); + assertStringIncludes(again.stdout, "accueil-390.png : identique"); + assertStringIncludes(again.stdout, "sous-agent (skill visual-proof)"); + } finally { + stop.abort(); + await server.finished; + } + } finally { + await Deno.remove(work, { recursive: true }); + } + }, +}); diff --git a/test/fixtures/golden-tree.txt b/test/fixtures/golden-tree.txt index 8e30f31..ff51943 100644 --- a/test/fixtures/golden-tree.txt +++ b/test/fixtures/golden-tree.txt @@ -49,11 +49,16 @@ .agents/skills/tdd/SKILL.md .agents/skills/tdd/mocking.md .agents/skills/tdd/tests.md +.agents/skills/visual-proof +.agents/skills/visual-proof/SKILL.md +.agents/skills/visual-proof/scripts +.agents/skills/visual-proof/scripts/captures.ts .agents/skills/wayfinder .agents/skills/wayfinder/SKILL.md .agents/skills/writing-great-skills .agents/skills/writing-great-skills/GLOSSARY.md .agents/skills/writing-great-skills/SKILL.md +.agents/synthesis.md.tpl .agents/user.md.tpl .agents/workflow.md .claude diff --git a/test/init.test.ts b/test/init.test.ts index 3bd7b60..542d414 100644 --- a/test/init.test.ts +++ b/test/init.test.ts @@ -8,6 +8,7 @@ import { assertStringIncludes, } from "@std/assert"; import { join } from "@std/path"; +import { glueItem, glueSection, parseGlue } from "../src/glue.ts"; import { goldenTree, installedTree, @@ -282,3 +283,37 @@ Deno.test("journal: written once, and never beside a journal the repo already ha assertNotEquals(handWritten, journal); }); }); + +Deno.test("init: the review section and the synthesis template are installed", async () => { + await withRepo(async (workspace) => { + const target = await workspace.copy("boilerplate"); + const result = await runChisel(["init", target]); + assertEquals(result.code, 0, result.output); + + assert( + (await Deno.stat(join(target, ".agents", "synthesis.md.tpl"))).isFile, + "the synthesis template is installed", + ); + const glue = parseGlue( + await Deno.readTextFile(join(target, ".agents", "project.md")), + ); + assertEquals( + glueItem(glueSection(glue, "J"), "Default depth")?.value, + "full", + "§J declares a default review depth", + ); + for ( + const label of [ + "E2E command", + "Recording command", + "Screenshot command", + "Proofs folder", + ] + ) { + assert( + glueItem(glueSection(glue, "J"), label) !== undefined, + `§J declares the ${label} line`, + ); + } + }); +});