diff --git a/.agents/skills/data-migration/SKILL.md b/.agents/skills/data-migration/SKILL.md
new file mode 100644
index 0000000..07483cf
--- /dev/null
+++ b/.agents/skills/data-migration/SKILL.md
@@ -0,0 +1,132 @@
+---
+name: data-migration
+description: 'The project''s rules on data and migrations: schema expand/contract, backfill, data deletion, data ownership by module. Load this playbook when you are touching: a data schema, a migration, existing data.'
+---
+
+
+
+# Playbook — Data and migrations
+
+> **Trigger.** Load this playbook when you are touching: a data schema, a migration,
+> existing data.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/data-migration.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Absolute rules
+
+| # | Rule |
+|---|---|
+| DM1 | **A migration is a production change**, not a code change. It falls under high-risk actions (kernel §5). |
+| DM2 | **Each module owns its data.** No direct access to another module's database — you go through its contract. |
+| DM3 | **Never rename or delete in place.** You add, you let both coexist, you migrate, you remove. |
+| DM4 | **Every migration has a rollback plan**, or a written justification for not having one. |
+| DM5 | **Never run a destructive migration without explicit confirmation.** |
+
+---
+
+## 1. Expand / Contract applied to the schema
+
+The same logic as contracts (`.nstack/handbook/03-contracts.md`), for the same reason: the old and
+the new code coexist during the deployment.
+
+```mermaid
+flowchart TD
+ A["Need: rename a field
or change its type"] --> B["1 · EXPAND the schema
add the new field,
nullable, touching nothing"]
+ B --> C["2 · Double write
the code writes both"]
+ C --> D["3 · Backfill
fill in the existing rows,
in batches, idempotent, resumable"]
+ D --> E["4 · Switch reads
the code reads the new field"]
+ E --> F{"Stable in
production?"}
+ F -->|No| E2["Read from the
old field again"] --> D
+ F -->|Yes| G["5 · Stop writing
the old field"]
+ G --> H["6 · CONTRACT
drop the old field"]
+
+ style B fill:#065f46,color:#fff
+ style D fill:#1f2937,color:#fff
+ style H fill:#7c2d12,color:#fff
+```
+
+**Legend** — green: the additive step, always safe · dark grey: the operational step ·
+red: the irreversible step, the one that gets forgotten.
+
+Each step is **a pull request deployable on its own**. At no point is the system in a
+state where a rollback would break the data.
+
+Step 6 is the most forgotten. It carries a date and an owner, in a *Technical debt*
+issue: no check reads a schema's dates, so the contraction is the project's to track.
+
+---
+
+## 2. Before any migration
+
+| Question | If the answer is missing |
+|---|---|
+| How many rows are affected? | Measure before writing the migration |
+| Does it lock a table? For how long? | Test on a representative volume |
+| Does the old code still work afterwards? | It must, during the deployment |
+| Does the new code work beforehand? | Same, the other way round |
+| What happens to non-conforming data? | Count it, decide explicitly |
+| How do you roll back? | Write the plan, or justify its absence |
+| How will you know it went well? | Define the verification before starting |
+
+---
+
+## 3. Backfill
+
+A backfill over a large volume is an operational procedure, not a script.
+
+- **In batches**, with a pause between batches — never process everything at once.
+- **Idempotent**: re-runnable with no side effect.
+- **Resumable**: remembers its progress, survives an interruption.
+- **Observable**: progress, errors, estimated duration.
+- **Interruptible**: it must be possible to stop it without corrupting the state.
+- **Measured beforehand**: row count, estimated duration, impact on load.
+
+---
+
+## 4. Deleting data
+
+This is irreversible. Mandatory procedure:
+
+```
+1. count exactly what will be deleted
+2. check the selection criterion against a sample
+3. back up or archive what is being deleted
+4. run in dry-run mode first
+5. ask for explicit confirmation, with the exact count
+6. delete in batches, with a stopping point
+7. verify afterwards
+```
+
+A deletion triggered by a retention rule is a product decision: it belongs to a PDR, not
+to a technical task.
+
+---
+
+## 5. Data ownership
+
+Implicit data sharing is the hardest form of coupling to undo, because it is invisible
+in the code.
+
+| Situation | Handling |
+|---|---|
+| A module reads another's table | A violation — detected by a fitness function |
+| Database shared between two modules | ADR required, with explicit ownership per table |
+| Data duplicated across modules | Acceptable when a source of truth is designated and the synchronisation is contractual |
+| A join across domains is needed | A signal of a bad boundary — do not work around it with direct access |
+
+---
+
+## 6. Closing checklist
+
+- [ ] Migration tested on a representative volume
+- [ ] Old and new code both work during the transition
+- [ ] Backfill in batches, idempotent, resumable
+- [ ] Rollback plan written, or its absence justified
+- [ ] Post-migration verification defined **before** the run
+- [ ] Contraction step planned, with a date and an owner
+- [ ] Destructive action explicitly confirmed, with the exact count
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.agents/skills/discovery/SKILL.md b/.agents/skills/discovery/SKILL.md
new file mode 100644
index 0000000..74757ee
--- /dev/null
+++ b/.agents/skills/discovery/SKILL.md
@@ -0,0 +1,135 @@
+---
+name: discovery
+description: 'The project''s discovery rules: turning an idea into a decision — intake, sourced market research, definition, the value hypothesis and no-gos, a challenge by another session (pre-mortem, four risks), then go, clarify or kill. Load this playbook when you are touching: an idea to test, a discovery to challenge or decide.'
+---
+
+
+
+# Playbook — Discovery
+
+> **Trigger.** Load this playbook when you are touching: an idea to test, a discovery to
+> challenge or decide.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/discovery.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Your posture
+
+You run stages 1 to 4 as the **framer**, stage 5 only as the **challenger** — never both in
+the same session. The decider decides, at stage 6. For the framer and the challenger, this
+playbook replaces the kernel's working loop (§2); its closing summary (§8) still applies.
+
+| You do | You never do |
+|---|---|
+| Framer: ask one question at a time, only what you cannot infer | Agree to please; soften an objection |
+| Give every market fact its source | State a fact you cannot source — write it as an assumption |
+| Keep the document to what could change the decision | Fill a canvas, size a market, invent personas |
+| End each round with a decision | Open a new direction before the round is decided |
+
+The engine's `discover` command created `docs/project/discovery.md`: one section per stage,
+each ending with its open questions. When the decider cannot answer now, write the question
+there — most decision-changing first — and go on; never answer it in their place.
+
+---
+
+## 1. Intake
+
+Read the idea file entirely. Restate the idea in one paragraph — for whom, where, which
+problem, what the product does — and ask the decider to correct it. Record the decider in
+the front matter. Until the decider confirms the paragraph, mark it *unconfirmed*: the round
+cannot be decided while it is.
+
+Ask, once, **in which language the project writes** — its documents, its code, its commit
+messages. The idea file may be in one language and the framework's forms in another; nobody
+notices until half the documents are in each. The answer is the project's first rule: one
+line of `docs/project/rules/always.md`, written now, with the idea file left as it was given.
+
+Ask, once, **what has already been asked of, promised to, or received from someone outside the
+team** — a client, a vendor, a partner — by mail, chat or meeting. A fresh session remembers none
+of it, and an outside party asked twice, or asked differently, pays for it in patience. Each answer
+is an entry of the project's log issue, opened now if there is none (`.nstack/handbook/06-decisions.md`
+§9): who, what, when, by which channel — never a secret or a credential, and nothing the outside
+party would not have public in a public repository's issue (`security.md`).
+
+## 2. Research
+
+With the research tools of `.nstack/tooling-profile.md` — or, when that row is empty, the tools
+at hand, named in the document — look for:
+
+- what users do today instead, including nothing;
+- the direct and indirect alternatives, their positioning and their price;
+- the business models of the field;
+- the legal and regulatory constraints, for the countries concerned.
+
+Each finding goes in the evidence table, with what it changes for the idea and its source.
+Prefer the primary source; mark figures a company reports about itself, and claims seen only
+in a search excerpt. A claim without a source goes to *Assumptions*. Stop when each of the
+four points has at least one sourced finding, or an explicit "not found".
+
+**A legal or regulatory claim is read at its primary source — the text itself, the
+regulator's page — or it is an assumption.** A summary of a law by someone who sells a
+product under it is not a source, and a rule the design will rest on is the last thing to
+take second-hand: say "not read" rather than mark it as seen elsewhere.
+
+## 3. Define
+
+With the decider: the users; their problem — quoted from users, saying who and how many,
+since words reported by the decider alone are an assumption; the constraints — who runs it,
+budget, platforms, regulation; and the success signals — what will be observed, and by when,
+if the idea is right. If this stage changes the users or the model, revisit stage 2.
+
+## 4. Shape
+
+- **The value hypothesis** — why a user would switch from what they do today, in one or two
+ sentences, stated so that it can be proven wrong. Not a list of features.
+- **A short press release**, dated launch day — a placeholder if none is set: the user, the
+ problem, the product, one quote, labelled as imagined. Record whether it convinces the
+ decider; if it does not, that is a finding.
+- **No-gos** — what the product deliberately will not do: the decider's, and any the framer
+ proposes, marked *proposed*.
+
+## 5. Challenge — in another session
+
+A session that did not write stages 1 to 4, or a human; it starts once section 1 is
+confirmed — otherwise it names the reading it challenges. The challenger does not interview
+the decider: its questions go into its objections. It reads the idea file and the document,
+then:
+
+1. **Pre-mortem** — the product launched a year ago and failed: the plausible reasons, each
+ tagged with its risk.
+2. **The four risks** — *value*: will they use it, or buy it? *usability*: can they use it?
+ *feasibility*: can it be built with the means at hand? *viability*: does it hold for the
+ business — cost, law, operations? For each, the riskiest assumption and the cheapest test
+ that could refute it: what is done, for how long, and the result that refutes it — a
+ threshold proposed, for the decider to set.
+3. **Counter-evidence** — what contradicts the value hypothesis or the riskiest assumptions:
+ failed products, closed competitors, regulatory refusals. Research as in stage 2 — same
+ tools, same marking, the same stopping rule; an unsourced claim is marked *assumption*.
+4. **Flaws in stages 1 to 4** — each citing the line it objects to.
+
+These are the objections, written in section 5 with the challenger's name and date. Never
+rewrite stages 1 to 4.
+
+## 6. Decide
+
+A framer session presents section 5 unchanged, then the riskiest assumptions and the value
+hypothesis. The decider chooses:
+
+| Decision | What follows |
+|---|---|
+| **go** | The pull request that records the decision writes the front page's sentence (`README.md`) — what the product does, for whom, as the decider confirmed it — and nothing else of that page. The framing then writes the charter from this document (`framing.md`); the tests the decider keeps become spike deliverables of the first cycle |
+| **clarify** | A new round on the open questions, and on the cheap tests the decider picks before any charter; `round` goes up, section 5 is kept under its round, and the changed sections are challenged again |
+| **kill** | The document stays, with its reasons — the cheapest outcome of all |
+
+Section 6 records the reasons, and for a go, why each objection does not block it. Record
+`decision` and `decided_on` in the front matter, then run the fitness functions.
+
+---
+
+## Bounds
+
+A round is one or two working sessions. A second `clarify` is the decider's explicit choice,
+recorded in section 6 — never a default.
diff --git a/.agents/skills/documentation/SKILL.md b/.agents/skills/documentation/SKILL.md
new file mode 100644
index 0000000..2f74950
--- /dev/null
+++ b/.agents/skills/documentation/SKILL.md
@@ -0,0 +1,94 @@
+---
+name: documentation
+description: 'The project''s rules for writing a document: a diagram with its legend first, a few lines after it, a source for every outside claim, a date on every decision, and documents kept current or deleted. Load this playbook when you are touching: a document a human will read, a pull request''s description included: writing or changing one.'
+---
+
+
+
+# Playbook — Documentation
+
+> **Trigger.** Load this playbook when you are touching: a document a human will read, a
+> pull request's description included: writing or changing one.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/documentation.md`
+> — read them with this playbook. They add to it or tighten it.
+
+```mermaid
+flowchart LR
+ Q{"Is there a structure,
a flow or a state
to show?"}:::ask
+ Q -->|yes| D["A diagram
with its legend"]:::first
+ Q -->|no| T["A table,
or three lines"]:::first
+ D --> L["A few lines:
what the diagram
cannot say"]:::then
+ T --> L
+ L --> S["Sources and dates"]:::then
+ S --> C{"Still true
after this change?"}:::ask
+ C -->|no| U["Bring it current
or delete it"]:::stop
+
+ classDef ask fill:#374151,color:#fff
+ classDef first fill:#065f46,color:#fff
+ classDef then fill:#1e3a8a,color:#fff
+ classDef stop fill:#7c2d12,color:#fff
+```
+
+**Legend** — grey: what you ask yourself · green: what the reader sees first · blue: what
+follows it · red: the document that no longer says what is true.
+
+---
+
+## The standard — five rules, and no content
+
+1. **Shape first**: a diagram with its legend before the prose, wherever there is a structure,
+ a flow or a state to show. A reader who stops after the diagram has understood.
+2. **A source for every claim about the outside world** — a market, a law, a tool's
+ behaviour, a number.
+3. **A date on every decision**, and on every criterion that will judge it.
+4. **Current, or deleted.** A stale page costs more than a missing one, because it is
+ believed.
+5. **A fact has one home.** Its home is the file a check or a command reads — a module's
+ manifest for its responsibility, owner and criticality; the cycle for a deliverable's criteria, and its state once the cycle is closed — during it, the
+ hold and the delivery record, which `nstack plan` reads;
+ the charter for the decider. Every other document that needs the fact links to it, never
+ copies it: two copies agree on the day they are written, and only on that day.
+
+The framework asks for this form and writes none of the content: what the document says is
+the project's.
+
+---
+
+## Drawing the diagram
+
+| Situation | Action | Verification |
+|---|---|---|
+| Parts and what links them: modules, users, systems | Boxes and arrows, a dozen boxes at most | Someone reading the diagram alone can say what the document is about |
+| Things that happen in an order | A sequence, left to right or top to bottom | Every step has one way in |
+| Something that changes state | The states and what moves it from one to the next | No state is a dead end unless it is meant to be |
+| A choice between paths | A decision tree, the question in the node | Every branch ends on an action |
+| A colour or a shape is used | It means one thing, and the legend under the diagram says which | The legend names every colour used, and nothing else |
+| The diagram is ready | Written as text in the file, in the notation the tooling profile names — never an image. A drawing of a screen is no diagram: it is an image, frozen (`framing.md` §2) | The pull request shows what changed in it |
+| Nothing to show: one fact, a list, a comparison | No diagram. A table, or three lines | A diagram that decorates is removed |
+| More than a dozen boxes | Two diagrams, one idea each | Each has its own legend |
+
+## After the diagram
+
+- **Say what the diagram cannot**: the why, the exception, the number. Never describe the
+ diagram in words.
+- **A table for anything a reader will compare**; a list for anything they will tick.
+- **The point first.** A reader who must scroll to find what was decided has been given a
+ story instead of a document.
+- **Short.** A paragraph a reader skips is a paragraph to delete.
+
+## Which document, and when
+
+Each document of a project has the event that makes it writable; before it, its form stays
+a form. The table is `.nstack/handbook/06-decisions.md` §10 — read that one section before writing a
+document the project does not hold yet, and never fill a form with what nobody has decided.
+
+---
+
+## Closing checklist
+
+- [ ] The diagram comes first, with its legend — or there is nothing to draw, and no diagram
+- [ ] Every claim about the outside world names its source
+- [ ] Every decision and every criterion carries its date
+- [ ] Every document this change makes untrue is brought current in the same pull request
diff --git a/.agents/skills/framing/SKILL.md b/.agents/skills/framing/SKILL.md
new file mode 100644
index 0000000..8067410
--- /dev/null
+++ b/.agents/skills/framing/SKILL.md
@@ -0,0 +1,227 @@
+---
+name: framing
+description: 'The project''s framing rules: interviewing the decider, writing the charter, planning a bounded cycle with its deliverables, acceptance criteria and appetite, handling new ideas, and closing a cycle at its end or at its circuit breaker. Load this playbook when you are touching: framing a project, planning or closing a cycle.'
+---
+
+
+
+# Playbook — Framing
+
+> **Trigger.** Load this playbook when you are touching: framing a project, planning or
+> closing a cycle.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/framing.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## When framing is worth it
+
+A project is **unframed** until its charter is accepted: a stage, not a fault. Every rule
+judges its changes except the three that bound work inside a cycle. Framing buys an
+appetite, an end date, a circuit breaker and a decider — worth their price **when there is
+something to bound**: several people, a deadline, a decider who is not the one typing. Say
+so when you are asked to frame a project where none of the three is true; then frame it if
+the decider still wants it. Never frame to make a check pass: no check asks for it.
+
+## Your posture
+
+You are the **framer**. You propose; the decider decides. For the framer, this playbook
+replaces the kernel's working loop (§2); its closing summary (§8) still applies.
+
+| You do | You never do |
+|---|---|
+| Interview the decider, one subject at a time | Decide in their place, or fill a gap with an invention |
+| Propose the field's convention by default, marked *(framer, to confirm)* with its source | Propose more than the need |
+| List the open questions, blocking apart | Let a charter or a cycle be accepted with a blocking question open |
+| Keep the first cycle small | Split into many modules on day one (`.nstack/handbook/02-modules.md` §3) |
+
+A proposal without a source is an open question, not a proposal. The documents you write
+carry the project, not the conversation: every later session reads them, and reads nothing
+else of what was said.
+
+---
+
+## 1. Frame the project: the charter
+
+Start from what the decider gives you. When `docs/project/discovery.md` exists, its decision
+must be **go**: the charter reuses its users, problem, constraints, success signals, no-gos
+and risks, carries its unanswered questions into its own, and you ask only what it leaves
+open. Otherwise — an idea alone — propose a discovery first (`discovery.md`); a specification
+already challenged can be framed directly. Read the source entirely, then interview, one
+subject at a time, asking only what you cannot infer:
+
+| Subject | Ask | The charter records |
+|---|---|---|
+| Users | Who uses it, in what situation, with what problem? | The users and their problem |
+| Outcome | What must be true for the project to be finished? | Success criteria, measurable, dated — or relative to a named event, such as launch day, that a later framing dates |
+| Constraints | Law, money, security, data, platforms, deadlines | The constraints |
+| Risks | What could make it fail, or cause harm? | The risks, and the criticality they imply — what a failure of each module would cost, which the decider settles and `.nstack/handbook/05-workflow.md` §7 prices |
+| Vocabulary | The domain's words, and what each one means | The vocabulary |
+| Not this project | What it will deliberately not do | Out of scope |
+| Outside the team | What has already been asked of, promised to, or received from someone outside the team — a client, a vendor, a partner — by any channel? When the discovery asked it, only what changed since; otherwise, in full | Nothing in the charter: each answer is an entry of the project's log issue (`06-decisions.md` §9) |
+
+A domain that moves money, handles personal data or acts on someone's behalf raises the
+criticality of the modules concerned, and `security.md` applies from the first cycle — to
+the code, and to the data a spike collects: who sees it, how long it is kept. Say so to the
+decider.
+
+**Before proposing a criticality, read the rule** — the last paragraph of
+`.nstack/handbook/05-workflow.md` §7: a module that holds a key, places an order, moves money or
+touches someone's personal data is `critical`. Propose what the rule says, with what each
+value costs; a lower value is the decider's to choose, and is written as a deviation with its
+reason and the event that ends it.
+
+When no discovery came first, ask too **in which language the project writes**; the answer is
+its first rule (`docs/project/rules/always.md`).
+
+**A constraint that binds how the work is done becomes a rule of the project**, proposed
+with the charter: one line of `docs/project/rules/.md`, from
+`.nstack/forms/rules.md` — the subject is the playbook it completes, `always` when
+it applies to every task. It names its source in the charter and how it is checked. Never
+write it into a playbook or the kernel: those are every project's, and the next update
+would conflict on it.
+
+Write `docs/project/charter.md` from `.nstack/forms/charter.md`, with
+`status: proposed` and the open questions at the end, then run the fitness functions.
+"Finished" means the charter's goal is reached: framing stops; running what was built may go
+on.
+
+## 2. Plan a cycle
+
+1. **Goal** — one sentence, the one outcome of this cycle.
+2. **Deliverables** — a finite list, `D1`, `D2`…, each an outcome a user can observe — for a
+ spike, the question it answers for the decider. Each gets acceptance criteria, written
+ *given · when · then*; they become its test sheet (`verification.md`).
+
+ **Two questions to ask of each one, before writing its criteria:**
+ - *Can the team finish it alone, inside this cycle?* If it waits on someone outside the
+ project — a reply, an opinion, a decision elsewhere — it is a **dependency with a date**,
+ not a deliverable. Name it in the risks and give it a date; the cycle does not hold it.
+ - *Is its product knowledge rather than code?* Then it is a **spike**, and its criteria say
+ **what will be recorded** and **the threshold it is read against** — never that the answer
+ comes out a particular way. **A refuted result is a delivered one.** "Five people were
+ asked, one acted, below the threshold of two" closes the deliverable; it does not fail it.
+ When its product is a **drawing** — the screens, the journey the user will see — the
+ drawing is committed under `docs/project/drawings/-/` with its date,
+ and frozen: what the decider accepts in it becomes criteria of the deliverable that
+ builds it, and once built, the product and its screenshots are the truth. A new round is
+ a new folder, never an update.
+
+ A criterion nobody can meet is not met. It is answered with something that looks like proof,
+ and that answer is reviewed and merged like the rest.
+3. **Unknowns** — a blocking unknown becomes a *spike* deliverable, whose output is
+ knowledge (`.nstack/handbook/05-workflow.md` §3). After a discovery's go, the tests the decider kept
+ are the first cycle's spikes.
+4. **Modules** — name each deliverable's module; a spike run outside the code — a sign-up
+ form, interviews, a measure whose product is a record and not shipped code, even about one
+ module — has none (`module: null`): no merge carries it, so `nstack deliver` has nothing to read. Propose a new module only against the tree of
+ `.nstack/handbook/02-modules.md` §3: one module is often enough to start.
+5. **Appetite** — ask the decider how many weeks they **want** to spend, not how long it
+ will take — in days for a cycle shorter than a week, such as an engagement whose date an outside
+ party sets (`appetite_days`), never rounded up to a week nobody agreed to. When the deliverables
+ do not fit, cut the scope; never stretch the appetite.
+6. **Out of scope and later** — out of scope is not done even if time remains; *later* holds
+ the candidates for the next framing.
+
+Write `docs/project/cycles/NN-.md` from `.nstack/forms/cycle.md`, with
+`status: proposed` and `end` = `start` + the appetite, then run the fitness functions.
+
+## 3. Hand over to the decider
+
+A cycle's *What needs a person* holds what only a person can do, each with its literal gesture: fill it
+while framing, and keep it true. It is what `nstack plan` opens with. A request to someone outside
+the team starts from the log issue's entries, and from the decider's answer to what has been asked,
+promised or received outside since the last one — every cycle, not only the first: nothing already
+asked is asked again, nothing is asked more broadly than before without saying why, and each new
+request becomes an entry. One still awaiting a reply that a deliverable needs is a dependency with a date.
+
+Present the charter, the cycle, the open questions, what went to *later*, and what you are
+unsure of — the cycle also as the board will show it: `nstack board --dry-run` previews the
+milestone and the issues its acceptance would create, and what it would collide with, and makes
+none; put the lines under *On acceptance of cycle …* in the framing pull request's description. The decider amends; the framer sets `status: accepted` — on the charter, then on the
+cycle — in a pull request the decider approves, and that approval is their gesture; accepted after `start`, the cycle's `start` and `end`
+move in the same pull request. **The next cycle, accepted while one runs**, stays `proposed` — one
+accepted cycle at a time (C5) — and gains `accepted_on: `: `nstack plan` stops asking
+for it while that cycle runs, and the running cycle's closure starts it (§5). The modules accepted there are created with the engine's
+module scaffolding, declared user-facing when a user sees them.
+
+**Where the project's own rules waive approval** — an agent merging alone on an attested,
+verified head, `doctor`'s G2 taken knowingly — nobody approves that pull request, and the
+decider's word stands for the approval: quoted in the page it accepts (the charter, the cycle),
+with its date and where it was said — a comment, a message, a meeting's note. The same holds
+for a deliverable accepted below. Without that line, the acceptance is the agent's alone.
+
+**The pull request that accepts the charter writes the project's front page from it** —
+`README.md`: a diagram of who uses the product and what it talks to, how to run what exists,
+and the sentence when no discovery wrote it. Until then that page holds its sentence at most;
+from then on the plan check refuses an accepted charter over a form left as it came
+(`.nstack/handbook/06-decisions.md` §10, `documentation.md`).
+
+## 4. During the cycle
+
+- **A new idea** goes to *later*. It enters the cycle only if the decider re-frames:
+ swapping a deliverable out, adding one they judge fits what is left of the appetite —
+ the end date does not move — or closing the cycle early. An added deliverable takes its
+ criteria like the others, and its section says on whose word and on what it entered.
+- **An urgent fix** outside the cycle — an incident, a production defect — goes in a pull
+ request with the `out-of-cycle` label and the line `Out of cycle: `.
+- **A deliverable's state** is written in the cycle file at framing (`proposed`, then `ready`:
+ testable criteria, set by the framer, confirmed when the decider accepts the cycle), on a
+ re-framing (`deferred`, `dropped`), and at the closure (`accepted`, by
+ `nstack deliver --write-states`) — never during delivery, and never in a delivery's pull request.
+ In between, `nstack plan` reads it: *held* from its claim, *delivered* from its record
+ (`nstack deliver D --held '#'`, kernel §2 step 12, `.nstack/handbook/project.md`);
+ it asks the decider nothing. It is accepted when each of its criteria is held by a scenario of a merged sheet, or by an
+ answer in the acceptance issue the cycle names beside the state (`.nstack/handbook/05-workflow.md`
+ §7); a criterion only a person can try waits for that answer. A spike outside the code is held
+ by a decision record when it binds the project (*Decisions* below), otherwise by a line of the
+ log issue it was run under — the project's, or its module's —, which its section links: with no merge it has no record, and the closure
+ writes its `accepted` by hand beside the states `--write-states` wrote, citing that line. Where
+ approval is waived (§3), the decider's word is quoted once, at the closure, for the cycle. A rule
+ sees that a merge exists, not that a criterion holds: the closure reads the records before it
+ writes.
+
+## 5. The end of a cycle
+
+**Every deliverable delivered or accepted** — `nstack deliver --write-states`, and `nstack plan --prune` for the empty start branches a deferred deliverable left, then write the closure: what was delivered, which success
+criteria moved, what was deferred, and **which documents the cycle brought current** — the
+front page and the module map first, each with its pull request; set `status: closed`,
+`outcome: completed`, `ended_on`. A next cycle carrying `accepted_on` is set `status: accepted` in the
+same pull request; its `start` becomes the closure's day when it is not, and its `end` follows the appetite.
+A success criterion the decider says moved is recorded under `success:` in the front matter, at
+any closure — by its number in the charter, `met`, or `observing` with the day observation
+started; the latest record is its state, and `nstack plan` counts the criteria met.
+When a spike refutes what the charter rests on, present stopping the project too.
+
+**The end date reached first** — the circuit breaker: nothing is extended. Present the
+three choices, with the state of every deliverable. Whichever is chosen, `nstack deliver --write-states` comes
+first, while the cycle is still accepted: it is what brings the records into the cycle file.
+
+| The decider chooses | `status` | `outcome` |
+|---|---|---|
+| Ship what is delivered or accepted | `closed` | `shipped` |
+| Frame a new cycle, with a new appetite | `stopped` | `reframed` |
+| Stop the project | `stopped` | `stopped` |
+
+A next cycle carrying `accepted_on` starts here only on `shipped`, as on a completed closure. On `reframed` or
+`stopped`, the word was given for another situation: it stays `proposed`, and `nstack plan` asks the decider again.
+
+The closure is where the next framing starts. When `nstack plan` says the charter's goal is
+reached — every success criterion met —, present it: the decider says whether the project is
+finished.
+
+## Decisions
+
+A decision lives in a record, never in the charter, the cycle or a conversation
+(`.nstack/handbook/06-decisions.md`): one register of each kind at the project's root —
+`docs/pdr/` for the product, `docs/adr/` for the technique — and `Scope: module ` when it
+concerns one module.
+
+| When | Then |
+|---|---|
+| An accepted charter has to change — a constraint, a user, what the project is not | A **PDR** first, which the change cites; the charter is never rewritten in place (CI warns, C9) |
+| The framing chooses a module, a stack, a contract | An **ADR**: the module's creation decision is one |
+| A spike's result binds the project | A PDR or an ADR; otherwise a line in the project's log issue |
+| A cycle's **closure** | Read every decision the plan names as due (C10): its criterion names this cycle, or a date in bold, `**YYYY-MM-DD**`, its end reached. The record gains one line under its criterion, *Read at 's closure, : met \| missed \| superseded*, and nothing else; a *missed* one is the decider's to answer, by a new record or the removal condition |
diff --git a/.agents/skills/operations/SKILL.md b/.agents/skills/operations/SKILL.md
new file mode 100644
index 0000000..5c13a96
--- /dev/null
+++ b/.agents/skills/operations/SKILL.md
@@ -0,0 +1,184 @@
+---
+name: operations
+description: 'The project''s operations and reliability rules: timeouts, retries, structured logs, metrics, alerts, health checks, rollback and controlled degradation. Load this playbook when you are touching: logs, metrics, alerts, retries, timeouts, rollback, a deployment, a call to another system.'
+---
+
+
+
+# Playbook — Operations and reliability
+
+> **Trigger.** Load this playbook when you are touching: logs, metrics, alerts, retries,
+> timeouts, rollback, a deployment, a call to another system.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/operations.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Absolute rules
+
+| # | Rule |
+|---|---|
+| OPS1 | **Never an automatic retry without analysing the side effects.** |
+| OPS2 | **Every external call has an explicit timeout.** A call without one is an outage waiting to happen. |
+| OPS3 | **No secret and no personal data in the logs.** |
+| OPS4 | **An error quietly swallowed is a future incident.** |
+| OPS5 | **A module in production with no way of knowing it is unwell is not ready.** |
+
+---
+
+## 1. Retries — the classic trap
+
+```mermaid
+flowchart TD
+ A["Considering a retry"] --> B{"Is the operation
idempotent?"}
+ B -->|No| C["DO NOT RETRY.
Make it idempotent first,
with an idempotency key"]
+ B -->|Yes| D{"Is the error
transient?"}
+
+ D -->|"No: 4xx, validation,
authorisation"| E["DO NOT RETRY.
The result will be identical."]
+ D -->|"Yes: network, 5xx,
timeout"| F{"Exponential backoff
with jitter?"}
+
+ F -->|No| G["DO NOT RETRY.
A synchronised retry turns
a local incident into a global outage"]
+ F -->|Yes| H{"Maximum count
and total budget
defined?"}
+
+ H -->|No| G
+ H -->|Yes| I["Retry acceptable,
with a metric on the retry rate"]
+
+ style C fill:#7c2d12,color:#fff
+ style E fill:#7c2d12,color:#fff
+ style G fill:#7c2d12,color:#fff
+ style I fill:#065f46,color:#fff
+```
+
+**Legend** — red: do not retry, and why · green: the only branch where a retry is safe.
+
+Three side effects to check every time:
+
+- **Duplication** — a retry on a non-idempotent operation applies the effect twice.
+- **Amplification** — N clients retrying at the same time multiply the load on a service
+ already in trouble.
+- **Masking** — a retry that succeeds hides a real degradation. The retry rate is
+ therefore a metric, not an implementation detail.
+
+---
+
+## 2. Timeouts
+
+| Rule | Why |
+|---|---|
+| Every external call has an explicit timeout | A call without one blocks a thread indefinitely |
+| The timeout is shorter upstream than downstream | Otherwise the caller gives up before the callee, and the work is lost |
+| A total budget exists for the request | Prevents cascading timeouts from accumulating |
+| The timeout is a configured value, not a buried constant | It will need adjusting in production |
+
+---
+
+## 3. Logs
+
+| Do | Avoid |
+|---|---|
+| Structured, machine-readable | Concatenated strings nothing can parse |
+| A correlation identifier propagated | Logs impossible to tie together |
+| Useful context: what, where, which identifier | "Error" with no context |
+| Consistent levels, actually respected | Everything at `info`, or everything at `error` |
+| Masking sensitive data **at the source** | Masking at display time |
+
+A log that does not let you reconstruct what happened has only occupied disk space.
+Control question: *at 3 a.m., does this log let me understand without reading the code?*
+
+---
+
+## 4. Metrics and alerts
+
+| Type | Example |
+|---|---|
+| Traffic | Requests, messages processed |
+| Errors | Error rate, by type |
+| Latency | The distribution, not only the mean |
+| Saturation | Queue, connections, memory |
+| Business | What the module is supposed to produce |
+
+**The mean hides everything.** A healthy average latency can conceal 5 % of users waiting
+ten seconds. Always look at the distribution.
+
+### Alerts
+
+| Rule | Reason |
+|---|---|
+| Alert on a **user-visible symptom**, not on a technical cause | Causes change, the symptom stays relevant |
+| Every alert is **actionable** | An alert with nothing to do will be ignored |
+| Every alert points to a **runbook** | Otherwise the knowledge sits in one person's head |
+| An alert that fires with no action taken is **removed or fixed** | Noise destroys the value of every alert |
+
+---
+
+## 5. Health checks
+
+| Type | Answers | Trap |
+|---|---|---|
+| *Liveness* | Should the process be restarted? | Must **not** depend on external dependencies — otherwise an external outage causes a restart loop |
+| *Readiness* | Can it take traffic? | Must check the critical dependencies |
+| *Startup* | Has it finished starting? | Avoids restarts during a slow initialisation |
+
+---
+
+## 6. Deployment and rollback
+
+```mermaid
+flowchart TD
+ A["Change ready"] --> B{"Compatible with
the previous version?"}
+ B -->|No| C["Split it: make it compatible
first, then switch over"]
+ B -->|Yes| D["Deploy"]
+ D --> E["Smoke tests"]
+ E --> F{"Green?"}
+ F -->|No| G["Immediate ROLLBACK"]
+ F -->|Yes| H["Verification through
observability:
errors · latency · business"]
+ H --> I{"As expected?"}
+ I -->|No| G
+ I -->|Yes| J["Done"]
+
+ style G fill:#7c2d12,color:#fff
+ style J fill:#065f46,color:#fff
+ style C fill:#1f2937,color:#fff
+```
+
+**Legend** — red: roll back · green: done · dark grey: split the change instead.
+
+- **Rollback is tested**, not assumed. A rollback never executed probably does not work.
+- **A deployment is not finished at deploy time**: it is finished when observability
+ confirms the expected behaviour.
+- **Backward compatibility is mandatory**: during the deployment two versions coexist. An
+ incompatible change is split up (`.nstack/handbook/03-contracts.md`).
+
+---
+
+## 7. Controlled degradation
+
+Decide **in advance** what happens when a dependency is unavailable:
+
+| Strategy | When |
+|---|---|
+| Fail cleanly | The feature makes no sense without the dependency |
+| Serve a default value | An approximation beats nothing |
+| Serve from a cache, even a stale one | Freshness matters less than availability |
+| Disable the feature, keep the rest | The dependency is secondary |
+| Queue for deferred processing | The operation can be asynchronous |
+
+The choice is explicit and tested. Without a prior decision, the default behaviour is
+always the worst one: an opaque error at the worst possible moment.
+
+---
+
+## 8. Closing checklist
+
+- [ ] Explicit timeouts on every external call
+- [ ] Retries justified, idempotent, with backoff and a ceiling — or absent
+- [ ] Logs structured, correlated, free of secrets and personal data
+- [ ] Errors never swallowed quietly
+- [ ] Metrics and alerts actionable, pointing at a runbook
+- [ ] Health checks correct (liveness with no external dependencies)
+- [ ] Backward compatibility verified
+- [ ] Rollback documented and tested
+- [ ] Behaviour on unavailability decided explicitly
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.agents/skills/pause-and-resume/SKILL.md b/.agents/skills/pause-and-resume/SKILL.md
new file mode 100644
index 0000000..fd3fe6a
--- /dev/null
+++ b/.agents/skills/pause-and-resume/SKILL.md
@@ -0,0 +1,90 @@
+---
+name: pause-and-resume
+description: 'The project''s rules for ending and resuming a session: work committed and pushed before stopping, nothing left running, holds kept, a short resume note in .nstack/local/, and a restart that reads the note, renews its holds and runs nstack plan once. Load this playbook when you are touching: stopping, restarting, handing work over, or resuming a session.'
+---
+
+
+
+# Playbook — Pause and resume
+
+> **Trigger.** Load this playbook when you are touching: stopping, restarting, handing work over,
+> or resuming a session.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/pause-and-resume.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## The rule: the repository holds the state, a note points into it
+
+```mermaid
+flowchart LR
+ S["Stop
work pushed, tree clean"] --> N["Note
.nstack/local/resume.md"]
+ N -. restart .-> R["Resume
read the note, renew holds"]
+ R --> P["nstack plan, once"] --> G["the noted gesture"]
+ classDef state fill:#1f2937,color:#fff
+ class S,R state
+```
+
+*Legend: solid arrows are what you do in order; the dotted one is the session ending.*
+
+A session ends without warning: a restart, a full context, a person's evening. What it knew must
+already be where the next one reads it — commits, pull requests, holds — and the next one must
+not have to re-read the history to find it. A note of a few lines says where to look; it never
+replaces what it points to.
+
+Your tool's own memory, a chat summary or a transcript are extras: useful to you, invisible to
+another tool and to another person. The source is the repository and the forge.
+
+---
+
+## Stop
+
+Before you stop, or when you are told the session will end:
+
+1. **Nothing only in the working tree.** Commit what is in progress, on its work branch, and push
+ it: the pushed branch shows it, and on GitHub the claim's draft pull request too when the work
+ is on its first branch. A commit or a push a hook refuses: fix its cause; what you cannot fix
+ before stopping stays as it is, and the note names it with the refusal — never `--no-verify`.
+2. **Nothing running.** No background job, watcher or server left for the next session to find.
+3. **Nothing left over.** Scratch clones, worktrees and local branches of your own that hold no
+ work are removed; a worktree that holds work is pushed first. Never the start branch your
+ claim made: `nstack deliver` removes it.
+4. **Holds stay.** A deliverable you will resume stays held (`nstack plan` shows it). Past
+ `hold_days` without work, anyone may take it over: give back with `nstack unclaim` what you
+ will not resume by then.
+5. **Write the note.**
+
+## The note
+
+`.nstack/local/resume.md` — one per clone, never committed (`.nstack/local/` is ignored).
+Fifteen lines at most; over that, it repeats what the repository already says. Rewrite it
+whole at each stop: it states the present, not a journal.
+
+```markdown
+# Resume — 2026-11-24 18:40, session , for
+- Merged since the last note: D30 (#41)
+- Open: D31, pull request #44 — next: answer the verifier's finding on the empty state; mine
+- Open: D32, branch d32-export, pushed, no pull request yet — next: the test sheet; mine
+- Owed by others: the decider's approval of #42; the verifier's run of #44
+- Not pushed: (nothing) — or the commit, the files, and the hook's refusal
+- Next id: D33
+- Relaunch: nstack agent run --
+```
+
+Handing over to another session or person: give them the note's text with the hand-over, and
+give the hold back (`nstack unclaim`) for them to claim. Never hand over a clone.
+
+## Resume
+
+1. **Read the note, and only the note.** Not the history, not the transcripts. No note: `git
+ status`, `git log` of your branches and `nstack plan` say the same, more slowly.
+2. **Renew your holds** under this new session. In `nstack agent run`:
+ `nstack claim --person --session ` renews a hold your own agent
+ held. Outside it, a new session of yours takes its hold over, on your person's word:
+ `nstack claim --take-over --person --session `
+ (`.nstack/handbook/project.md`, *Who holds a deliverable*).
+3. **`nstack plan`, once**: what changed while you were away — merges, holds, what turned stale.
+ Where it disagrees with the note, the repository is right; the note was the past.
+4. **Continue at the noted gesture.** A gesture owed by someone else is not yours to redo.
diff --git a/.agents/skills/security/SKILL.md b/.agents/skills/security/SKILL.md
new file mode 100644
index 0000000..4f7dec9
--- /dev/null
+++ b/.agents/skills/security/SKILL.md
@@ -0,0 +1,134 @@
+---
+name: security
+description: 'The project''s security rules: authentication, authorisation, secrets, input validation, personal data, dependencies and high-risk actions. Load this playbook when you are touching: authentication, authorisation, secrets, personal data, external input, a new dependency.'
+---
+
+
+
+# Playbook — Security
+
+> **Trigger.** Load this playbook when you are touching: authentication, authorisation,
+> secrets, personal data, external input, a new dependency.
+>
+> Format: `situation → action → verification`. Anything not verifiable here must go to
+> human review.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/security.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Absolute rules
+
+| # | Rule |
+|---|---|
+| SEC1 | **No secret in the repository.** Not in clear text, not encoded, not "temporarily", not in a test, not in a comment. |
+| SEC2 | **All external input is hostile** until explicitly validated. |
+| SEC3 | **Least privilege by default** — including for CI and for agents. |
+| SEC4 | **Deny by default** in authorisation: whatever is not explicitly allowed is forbidden. |
+| SEC5 | **Never design your own** cryptographic, password-hashing or authentication mechanism. The established convention, always (Prior Art Gate). |
+
+If one of these rules has to be broken, this is no longer a development task: it is a
+decision, and it goes through an ADR and human approval.
+
+---
+
+## Authentication
+
+| Situation | Action | Verification |
+|---|---|---|
+| New entry point | Check it is covered by the existing mechanism, not a new one | Test: unauthenticated call → refused |
+| Password storage | A slow, standard hashing algorithm, never a homemade one | Test on the algorithm used |
+| Session or token | Expiry, revocation and rotation planned | Test: expired token → refused |
+| Authentication error message | Never reveal whether the account exists | Test on the message content |
+
+---
+
+## Authorisation
+
+This is the most frequent source of vulnerabilities, and the easiest to test.
+
+| Situation | Action | Verification |
+|---|---|---|
+| New endpoint or action | Decide explicitly who is allowed | Test per role: allowed, not allowed, not authenticated |
+| Access to a resource by identifier | Check ownership, not only the role | Test: user A reaches B's resource → refused |
+| List or search | Filter server-side, never client-side | Test: the response contains no one else's data |
+| Privilege escalation possible | Treat it as a high-risk action | Test + logging + human review |
+
+> **The most common trap.** Hiding a button in the interface is not an authorisation.
+> Every access rule exists server-side, and is tested there.
+
+---
+
+## Secrets
+
+| Situation | Action | Verification |
+|---|---|---|
+| A secret is needed | Environment variable or vault — never the code | Automated detection in CI |
+| Secret exposed, even briefly | **Rotate immediately.** Removing it from the commit is not enough | An incident, not a simple fix |
+| Secret in a test | A fake value explicitly named as such | Diff review |
+| Log containing a secret or a token | Mask at the source, not at display time | Test on the log content |
+
+---
+
+## Input and data
+
+| Situation | Action | Verification |
+|---|---|---|
+| User input | Validate structure, type, bounds, format — then sanitise | Test with invalid, empty, overlong, malformed input |
+| Query to a database | Parameterised queries, never concatenation | Injection test |
+| Displaying supplied content | Escape at render time, appropriately for the context | XSS test |
+| File upload | Type, size, extension, storage outside any executable area | Test with a hostile file |
+| Personal data | Minimise, encrypt at rest when sensitive, log access | Review + data inventory |
+| Application log | No personal data and no secret | Test on the log content |
+
+---
+
+## Dependencies and supply chain
+
+| Situation | Action | Verification |
+|---|---|---|
+| New dependency | Niche filter (`.nstack/handbook/06-decisions.md` §3) + declared in the manifest | Review: undeclared dependency (to automate) |
+| Reported vulnerability | Handle it by severity and real exposure, not by score alone | Automated analysis in CI |
+| Unmaintained dependency | Open a *Technical debt* issue with the exit strategy | Dependency review |
+
+---
+
+## Exposure and abuse
+
+| Situation | Action |
+|---|---|
+| Expensive public endpoint | Rate limiting, from the first version |
+| Sensitive operation | Auditable logging: who, what, when, from where |
+| Error returned to the client | A generic message; the detail goes to the logs |
+| Internal resource | Not exposed by default; exposing it is a decision |
+
+---
+
+## High-risk actions
+
+Changing permissions, accessing secrets, a change touching authentication, exposing a
+new service, an irreversible migration.
+
+**Mandatory procedure — never a silent execution:**
+
+```
+1. name the risk and its blast radius
+2. describe the state before / after
+3. propose the safe procedure and the rollback
+4. ask for explicit confirmation
+```
+
+---
+
+## Closing checklist
+
+- [ ] No secret added, in any form
+- [ ] Authorisation tested by role **and** by ownership
+- [ ] Input validated and sanitised, with negative tests
+- [ ] Logs free of secrets and personal data
+- [ ] Error messages uninformative to an attacker
+- [ ] New dependencies declared and filtered
+- [ ] High-risk actions explicitly confirmed
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.agents/skills/tests/SKILL.md b/.agents/skills/tests/SKILL.md
new file mode 100644
index 0000000..7408b9b
--- /dev/null
+++ b/.agents/skills/tests/SKILL.md
@@ -0,0 +1,218 @@
+---
+name: tests
+description: 'The project''s test strategy: choosing the test level, writing the oracle, edge cases, doubles and handling flaky tests. Load this playbook when you are touching: a non-trivial test strategy, a flaky test.'
+---
+
+
+
+# Playbook — Tests
+
+> **Trigger.** Load this playbook when you are touching: a non-trivial test strategy, a
+> flaky test.
+>
+> For an ordinary task the kernel rule is enough: **write the oracle, watch it fail,
+> implement**.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/tests.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## 1. Choosing the test level
+
+```mermaid
+flowchart TD
+ A["Behaviour to verify"] --> B{"Is it a pure
business rule?"}
+ B -->|Yes| U["UNIT TEST
fast, numerous, edge cases"]
+ B -->|No| C{"Does it cross a
module boundary?"}
+
+ C -->|Yes| CT["CONTRACT TEST
on both sides"]
+ C -->|No| D{"Does it depend on
real infrastructure?"}
+
+ D -->|Yes| I["INTEGRATION TEST
targeted, minimal scope"]
+ D -->|No| E{"Is it a critical
user journey?"}
+
+ E -->|Yes| E2["E2E — only when
genuinely critical"]
+ E -->|No| U
+
+ style U fill:#065f46,color:#fff
+ style CT fill:#065f46,color:#fff
+ style E2 fill:#7c2d12,color:#fff
+```
+
+**Legend** — green: the levels to prefer · red: the level to use sparingly.
+
+Preference rule: **the lowest level that actually verifies the behaviour**. An E2E test
+that could have been a unit test costs a hundred times more, breaks ten times more
+often, and diagnoses ten times worse.
+
+A scenario replayable end to end belongs in the module's `e2e` command, and its evidence in
+`.evidence/`: CI keeps it for the test sheet (`.nstack/handbook/05-workflow.md` §7) — where checks are
+attested, the verifier's evidence branch (`verification.md`, *Evidence*).
+
+**What the run said.** `nstack e2e` gives the run a folder of its own, `$NSTACK_EVIDENCE`
+(`/.evidence/e2e/`), keeps there the command's output — a traceback included — and then
+reads the log files the run wrote there:
+
+- **Write there** the module's logs (`.log`, `.jsonl`) and screenshots; data that are not logs —
+ recordings, events — elsewhere. A page's uncaught errors and console errors reach a log there:
+ logged by the page itself through the application, or collected by a script the scenario
+ injects (`window.onerror`, `unhandledrejection`) — some drivers expose no console.
+- **The audit** reads each line's level — JSON keys, `level=`, a level word leading the line, or
+ the module's `evidence.levels` expression. A warning or an error the module did not declare is
+ quoted with `file:line` and the declaration that would accept it: an error fails the run, a
+ warning fails from criticality `high` and is reported below. The first NapkinStack version that
+ brings the audit only reports; the project's next minor version judges.
+- **Declare** what the scenarios provoke on purpose, in the manifest — a pattern, its level, the
+ scenario that provokes it (M12). The manifest is the one place the audit reads: a warning or
+ an error a scenario provokes is declared there, even when the scenario asserts it too. A module
+ that declares lines and whose run wrote no log into `$NSTACK_EVIDENCE` fails when judged — they
+ were checked against nothing.
+- **Not run here.** A run that cannot run on this machine — no desktop, no sound server — says
+ why on its output and exits 77, the code Automake and Meson read as a skipped test: the run is
+ recorded *not run here*, what it logged is shown and nothing judged, and it passes. Exit 0 means
+ it ran; 77 for any other reason — some tools use it for a refused permission — reads as *not
+ run*, so a run that fails exits with another code.
+
+- **One run at a time, unless sealed.** What an end-to-end run drives — a sound server, a
+ display, a port — is the machine's, so `nstack e2e` runs one at a time on a machine, and a run
+ that waits says for whom, every minute. A module whose run shares nothing with another run
+ declares `evidence.sealed: true`: its run neither waits nor holds the machine. Declare it only
+ when each of these is true — two runs that share one of them see each other's state, and fail
+ for no reason of their own:
+
+ | Not shared | How to check |
+ |---|---|
+ | Session and devices: display, sound server, session bus | its run starts them, headless, and passes their address to what it drives (`DISPLAY`, `PULSE_SERVER`, `DBUS_SESSION_BUS_ADDRESS` from `dbus-run-session`) |
+ | Ports | each server binds port 0 itself and reports the port it got; never a fixed number, nor one picked and released before the server binds it |
+ | Files: build output, temporary files, sockets, state, configuration | everything it writes goes under a folder of its own run — the build tool's output folder set per run (`CARGO_TARGET_DIR`, not `build-dir`), `TMPDIR`, `HOME` and `XDG_*_HOME` pointed there —, never a fixed path |
+ | Processes | its teardown stops what it started — a process group it created (`setsid`, `start_new_session`), or the PIDs it recorded for a daemon that detaches — never by name or executable path |
+ | Per-user kernel limits: file watchers (inotify instances and watches), process count | its run closes what it opens, and as many runs as the machine takes at once stay under the user's limits (`fs.inotify.max_user_instances`, `fs.inotify.max_user_watches`, `ulimit -u`, which counts threads too); a limit run out fails at once, naming it — no folder of its own run isolates these |
+ | Timings, whatever the load | it passes with the machine busy; a run that waits for a quiet machine is the opposite of sealed |
+
+ The lock keeps unsealed runs apart, not sealed ones: a run that needs a quiet machine cannot get
+ one from the lock while sealed runs go beside it.
+
+```yaml
+evidence:
+ provoked:
+ - pattern: "key refused"
+ level: warning
+ scenario: S3
+ sealed: true # every row of the table above holds: runs beside any other
+```
+
+---
+
+## 2. The oracle
+
+| Requirement | Why |
+|---|---|
+| Written **before** the implementation | Otherwise it is written to pass, not to verify |
+| Watched **failing** first | A test never seen red may test nothing |
+| Fails for the **right reason** | A compilation failure is not a test failure |
+| Named after the **behaviour**, not the function | `refuses_an_order_without_stock`, not `test_create_order_2` |
+
+### When the oracle is impossible
+
+| Cause | Response |
+|---|---|
+| Subjective criterion | Restate it as an observable behaviour |
+| Exploratory task | Requalify it as a *spike*: the deliverable is knowledge |
+| Untestable area | Make it testable first, as a separate task |
+| Vague need | Back to framing — it was not *Ready* |
+
+In every case: **do not generate while waiting.**
+
+---
+
+## 3. What to test first
+
+```
+1. business rules 2. critical journeys 3. permissions
+4. contracts 5. errors 6. edge cases
+7. regressions that happened 8. high user impact
+```
+
+**Every regression fixed gets a test** that failed before the fix. That is the only
+guarantee it will not come back quietly.
+
+**Do not aim at a coverage percentage.** Coverage tells you what is not tested; it never
+tells you that what is tested is tested well.
+
+---
+
+## 4. Edge cases to consider every time
+
+```
+empty · null · absent · zero · negative · very large · very long
+special characters · unicode · leading and trailing whitespace
+duplicate · concurrency · repeated call (idempotence)
+dependency unavailable · timeout · partial response
+authorisation refused · not authenticated · session expired
+time zone · daylight saving · deadline date
+```
+
+---
+
+## 5. Flaky tests
+
+A flaky test is an **engineering problem**, never a fact of life. Its real cost: it
+teaches the team to ignore a CI failure. A single tolerated flaky test degrades the
+value of the whole suite.
+
+```mermaid
+flowchart TD
+ A["Flaky test detected"] --> B["Isolate it: quarantine,
do not delete"]
+ B --> C{"Cause?"}
+ C -->|"Real time"| D1["Inject the clock"]
+ C -->|"Execution order"| D2["Isolate state between tests"]
+ C -->|"Concurrency"| D3["Synchronise on the event,
never on a duration"]
+ C -->|"Network / external"| D4["Deterministic double"]
+ C -->|"Shared state"| D5["Reset for every test"]
+ C -->|"Undetermined"| E["The test proves nothing:
rewrite it or delete it"]
+
+ D1 --> F["Out of quarantine"]
+ D2 --> F
+ D3 --> F
+ D4 --> F
+ D5 --> F
+
+ style E fill:#7c2d12,color:#fff
+ style F fill:#065f46,color:#fff
+```
+
+**Legend** — green: back to a trustworthy suite · red: the test is not worth keeping.
+
+**Never "re-run until it passes".** A disabled test carries an issue and a date to pick
+it back up; without that, it never comes back.
+
+Fixed waits (`sleep`) are the most widespread cause of flakiness: wait for an
+**observable state**, never for a duration.
+
+---
+
+## 6. Doubles
+
+| Double | Do not double |
+|---|---|
+| External services, network, clock, randomness | The business logic of the module under test |
+| Slow or expensive dependencies | What the test is meant to verify |
+| Other modules — through their **contract** | The database, in an integration test |
+
+> **Never double another module's behaviour by guessing.** You double its contract, and
+> the contract test guarantees the contract matches reality. An invented double goes
+> green while production breaks.
+
+---
+
+## 7. Warning signals
+
+| Signal | Reading |
+|---|---|
+| A test breaks at every refactor with no behaviour change | It tests the implementation, not the behaviour |
+| You have to start another module to test | Bad boundary (`.nstack/handbook/02-modules.md` §9) |
+| The test is longer than the code it tests | The code is probably too coupled |
+| Nobody understands what this test tests | Delete it or rewrite it; it protects nothing |
+| The suite takes more than 10 minutes | It will be bypassed — making it fast is a priority task |
diff --git a/.agents/skills/ux/SKILL.md b/.agents/skills/ux/SKILL.md
new file mode 100644
index 0000000..248911a
--- /dev/null
+++ b/.agents/skills/ux/SKILL.md
@@ -0,0 +1,136 @@
+---
+name: ux
+description: 'The project''s UX/UI rules: the primacy of convention and of the design system, the eight states of an interface, error messages, accessibility, perceived performance and mobile behaviour. Load this playbook when you are touching: a surface visible to the user.'
+---
+
+
+
+# Playbook — UX/UI
+
+> **Trigger.** Load this playbook when you are touching: a surface visible to the user.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/ux.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Entry rule: convention wins
+
+This is the ground where the Prior Art Gate (`.nstack/handbook/06-decisions.md`) pays off most.
+
+> For an interface pattern, the value of the convention comes **precisely from the fact
+> that the user already knows it**. An unrequested interface innovation is a learning
+> cost imposed on every user for the satisfaction of a single designer.
+
+Before designing a component or a journey:
+
+1. does the project's design system already cover it? → use it, done.
+2. otherwise, what is the established convention for this problem? → adopt it.
+3. departing from it requires a named, observable user value.
+
+**Never create a component that already exists in the design system.** It is the most
+common form of wheel reinvention, and the most expensive to undo.
+
+---
+
+## The eight states of an interface
+
+A feature is not finished if one of these states has not been handled. It is the number
+one cause of the gap between "it works on my machine" and "it is usable".
+
+```mermaid
+flowchart LR
+ A["1 · Empty
first use"] --> B["2 · Loading"]
+ B --> C["3 · Nominal"]
+ C --> D["4 · Partial
incomplete data"]
+ D --> E["5 · Error
recoverable"]
+ E --> F["6 · Error
blocking"]
+ F --> G["7 · Empty after
a filter or search"]
+ G --> H["8 · Too much data
pagination, truncation"]
+
+ style A fill:#1f2937,color:#fff
+ style E fill:#7c2d12,color:#fff
+ style F fill:#7c2d12,color:#fff
+```
+
+**Legend** — dark grey: the state every user sees first · red: the error states.
+
+States 1, 7 and 8 are the most systematically forgotten. Yet state 1 is the one **every**
+user sees first.
+
+---
+
+## Error messages
+
+| Do | Avoid |
+|---|---|
+| Say what happened, in the user's language | Showing a technical code alone |
+| Say **what to do next** | "An error has occurred" |
+| Preserve what the user had typed | Clearing the form |
+| Distinguish an input error from a system failure | Treating both the same way |
+| Stay discreet about the technical detail | Exposing a trace or an exploitable detail |
+
+An error message with no possible action is a dead end: the user can only start again
+identically.
+
+---
+
+## Accessibility
+
+Not negotiable as soon as there is an interface. Minimum checks:
+
+| Point | Test |
+|---|---|
+| Full keyboard navigation | Go through the whole feature without a mouse |
+| Focus visible at all times | Tab from end to end |
+| Sufficient contrast | Automated check |
+| Images and icons that carry meaning | Text alternative |
+| Forms | Associated labels, errors tied to the field |
+| Information never carried by colour alone | Visual check |
+| Consistent heading structure | Document inspection |
+| Large enough touch targets | Test on a real mobile device |
+| Dynamic region | Change announced to screen readers |
+
+Whatever can be automated is automated in CI. **The rest is tested with the keyboard**,
+in a few minutes — the best effort-to-detection ratio in the field.
+
+---
+
+## Perceived performance
+
+What matters is the **felt** time, not the measured time.
+
+| Situation | Handling |
+|---|---|
+| Action expected to be instant | Immediate visual feedback, before the server even answers |
+| Short wait | A discreet indicator, no full blocking |
+| Long wait | Real progress, and a cancellable action where possible |
+| Content arriving in pieces | Reserve the space to avoid layout shifts |
+| Optimistic action | Plan the rollback explicitly in case of failure |
+
+---
+
+## Responsive and mobile
+
+The development machine is not representative.
+
+- Check at a narrow width, not only in a resized browser.
+- Test touch interactions: no hover as the only trigger.
+- Check the behaviour with the virtual keyboard open.
+- Check over a slow connection.
+
+---
+
+## Closing checklist
+
+- [ ] The 8 states handled, or explicitly out of scope
+- [ ] Convention or design system respected; every deviation justified
+- [ ] Error messages actionable
+- [ ] Full keyboard navigation, focus visible
+- [ ] Contrasts checked
+- [ ] Tested at a real mobile width
+- [ ] Visual feedback on every action
+- [ ] No component reinvented
+- [ ] The test sheet covers the 8 states, or states which are out of scope (`verification.md`)
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.agents/skills/verification/SKILL.md b/.agents/skills/verification/SKILL.md
new file mode 100644
index 0000000..818b384
--- /dev/null
+++ b/.agents/skills/verification/SKILL.md
@@ -0,0 +1,145 @@
+---
+name: verification
+description: 'The project''s rules for verifying a change: the verifier''s posture, running a test sheet against the running change, the evidence expected for each result, and what to report. Load this playbook when you are touching: verifying a change you did not write, filling in a test sheet.'
+---
+
+
+
+# Playbook — Verification
+
+> **Trigger.** Load this playbook when you are touching: verifying a change you did not
+> write, filling in a test sheet.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/verification.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Your posture
+
+You are the **verifier**. You did not write this change, and you do not fix it. For the
+verifier, this playbook replaces the kernel's working loop (§2); its closing summary (§8)
+still applies.
+
+| You do | You never do |
+|---|---|
+| Start from the need, the acceptance criteria and the test sheet | Read the diff before running the sheet |
+| Run every scenario against the running change | Fix the code, even one line |
+| Bring back evidence for every result | Write "passed" without evidence |
+| Report the gaps against the need or against correctness | Report a preference as a gap |
+
+The session that wrote the change cannot verify it: start another session, with a fresh
+context, or hand the sheet to a human. Sign the sheet with your session's identifier —
+`Verifier: session ` — or, as a person, `Verifier: @`. CI compares it with the
+change's authors and refuses a match; each person named must have written the sheet into the
+description or reviewed or commented on the pull request, under their own account. Writing the
+sheet starts the check again; a review or a comment is read at the next run, which any edit of the
+description starts.
+
+### Your own ground
+
+You verify on someone's machine, beside work that goes on. Leave it as you found it.
+
+- **A copy of your own**: a working tree checked out at the head, and build outputs of your
+ own. Check out the pull request's branch, one tracking it, or the head detached: a record made
+ on a branch of another name is another pull request's (`.nstack/handbook/05-workflow.md` §7). A tree another session edits, or outputs another branch built, give results that are
+ not this change's. Where a sandbox keeps `.git` read-only, a worktree cannot be added: a
+ `git clone --shared ` checked out at the head is that copy, ``
+ and build outputs both under your own cache (`$XDG_CACHE_HOME`, which `nstack agent run --
+ claude` sets — for Cargo, `CARGO_TARGET_DIR` there), never the system's temporary folder, which a quota shares with
+ everyone on the machine. Both are deleted when you leave.
+- **The machine's shared state** — a default device, a setting, a service, data others read —
+ is touched only as the scenario needs, and is put back after each run, also on failure.
+ What another program holds — a user's own running copy of the product, their files — is
+ never touched.
+- **What you start, you stop, by its process number** — never by a name or a pattern, which
+ also matches what is not yours. When you leave, nothing of yours is left running.
+- **The description is fetched again just before you write it**: the author may have edited
+ it since you read it, and your edit must keep theirs.
+
+---
+
+## The procedure
+
+1. **Read the need** — the deliverable, its acceptance criteria, the test sheet in the
+ pull request's description. Nothing else yet.
+2. **Start the change** — the module's `run` verb, or the environment named in
+ `.nstack/tooling-profile.md`. A module with no `run` verb — a library, a contract — has
+ nothing to start: its scenarios run through its tests, and you say so in your report.
+3. **Run each scenario**, in order:
+ - *automated* — the module's `e2e` verb, or its `test` verb when it declares no `e2e`;
+ the evidence is the CI run on the head commit, or its artefact — where checks are attested,
+ the evidence branch below — for a change to a
+ visible surface, read the run's screenshots and logs (`.evidence/e2e/`, its `audit.json`)
+ and cite what they showed: never "rendering not seen" on a scenario passed. An audit
+ `not run` (exit 77) ran no scenario: each one it stood for is *not verified*, or run where
+ it can run;
+ - *explored* — drive the interface yourself, in a browser, an emulator or on a device,
+ with the tools of the tooling profile; capture the screen at the step that proves the
+ result;
+ - *human only* — do not run it; check that its reason is stated and, when the
+ deliverable's acceptance rests on it, that an acceptance issue asks it of a person.
+4. **Record** each result in the sheet — `passed`, `failed — `, or
+ `not verified` — with its evidence and the short hash of the commit you tested; a `|` in a cell,
+ in a code span too, is written `\|`. What you
+ have to add goes on the line **`Verifier's remarks:`** under the table, never in a cell: a
+ scenario that passed by your own probe and not by the test it cites, a wording that claims
+ more than was exercised. A remark is not a result, and the approver reads it. After a
+ fix, an *automated* scenario is run again at the head and its Commit cell takes the head —
+ it is never confirmed; an *explored* one keeps its commit and is confirmed in
+ the `Confirmed` column with the head commit and what moved since — after a `;` when the cell holds an
+ earlier confirmation; at criticality
+ `critical`, every scenario is run again (`.nstack/handbook/05-workflow.md` §7).
+5. **Only then read the diff**, to explain a failure — never to decide a result — and ask one
+ question of its tests: **is the entry point a real user calls exercised the way they call
+ it?** A suite that always passes what the user never passes is green on a path nobody takes.
+6. **Report** the failures first — observed, expected, evidence — then any optional
+ remark, marked as such.
+
+### Mutants
+
+To show that a test pins what it claims, change the code it claims to pin and watch it fail — a
+mutant. A mutant can make the code loop forever, so it is never run unbounded:
+
+- **The language's tool first**, rather than a loop of your own: `cargo-mutants` (Rust; `--file`
+ to aim it, `--timeout` to bound it), `mutmut` (Python), Stryker (JavaScript, TypeScript, C#,
+ Scala), PIT (Java).
+- **By hand**, one mutant per run, each run under a time limit — `timeout 120 `; a timeout counts as killed: the mutant changed what the code does.
+- **The source restored on every exit**, not only at the end — `trap 'git checkout -- '
+ EXIT`, or mutate in a throwaway copy of your own (above).
+- **Report the counts** — killed, survived, timed out — and each survivor with its line: a
+ survivor is a test that does not pin what it claims.
+
+---
+
+## Evidence
+
+| Scenario | Evidence expected |
+|---|---|
+| An interface | A screenshot of the state that proves the result; a video for a sequence |
+| A mobile interface | The screenshot of the emulator or the device, with its width or model |
+| An API, a job, data | The command and its output, or the log lines |
+| Accessibility | The keyboard path followed, and the automated report when there is one |
+
+Test data only: never a real user's data, never a secret on a screenshot (`security.md`).
+Evidence lives where the whole team sees it — a CI artefact, or an image attached to the
+pull request. **Where checks are attested**, no CI run keeps an artefact, and an agent's identity
+cannot attach an image through the forge's API: the verifier commits the screenshots and videos
+that prove a criterion on a branch of its own, `evidence/`, never on the change's
+branch — its head stays the one verified (T4), and the verifier writes no commit of the change
+(T2) — and links each file from the sheet at that branch's commit. Made-up data only, each file
+read before it is pushed: a public repository keeps it for good, and no secret scanner reads an
+image (`security.md`). The `check-added-large-files` hook bounds each file as it is committed;
+the branch is deleted once the cycle is closed.
+
+A user-facing change covers the eight states of an interface (`ux.md`), or says which are
+out of scope. A state missing from the sheet is a gap to report.
+
+---
+
+## When the sheet itself is wrong
+
+A scenario that does not match the need, or a need no scenario covers: report it. An
+expected result changes only with the decider's agreement, visibly in the sheet's history.
diff --git a/.claude/skills/data-migration/SKILL.md b/.claude/skills/data-migration/SKILL.md
new file mode 100644
index 0000000..07483cf
--- /dev/null
+++ b/.claude/skills/data-migration/SKILL.md
@@ -0,0 +1,132 @@
+---
+name: data-migration
+description: 'The project''s rules on data and migrations: schema expand/contract, backfill, data deletion, data ownership by module. Load this playbook when you are touching: a data schema, a migration, existing data.'
+---
+
+
+
+# Playbook — Data and migrations
+
+> **Trigger.** Load this playbook when you are touching: a data schema, a migration,
+> existing data.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/data-migration.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Absolute rules
+
+| # | Rule |
+|---|---|
+| DM1 | **A migration is a production change**, not a code change. It falls under high-risk actions (kernel §5). |
+| DM2 | **Each module owns its data.** No direct access to another module's database — you go through its contract. |
+| DM3 | **Never rename or delete in place.** You add, you let both coexist, you migrate, you remove. |
+| DM4 | **Every migration has a rollback plan**, or a written justification for not having one. |
+| DM5 | **Never run a destructive migration without explicit confirmation.** |
+
+---
+
+## 1. Expand / Contract applied to the schema
+
+The same logic as contracts (`.nstack/handbook/03-contracts.md`), for the same reason: the old and
+the new code coexist during the deployment.
+
+```mermaid
+flowchart TD
+ A["Need: rename a field
or change its type"] --> B["1 · EXPAND the schema
add the new field,
nullable, touching nothing"]
+ B --> C["2 · Double write
the code writes both"]
+ C --> D["3 · Backfill
fill in the existing rows,
in batches, idempotent, resumable"]
+ D --> E["4 · Switch reads
the code reads the new field"]
+ E --> F{"Stable in
production?"}
+ F -->|No| E2["Read from the
old field again"] --> D
+ F -->|Yes| G["5 · Stop writing
the old field"]
+ G --> H["6 · CONTRACT
drop the old field"]
+
+ style B fill:#065f46,color:#fff
+ style D fill:#1f2937,color:#fff
+ style H fill:#7c2d12,color:#fff
+```
+
+**Legend** — green: the additive step, always safe · dark grey: the operational step ·
+red: the irreversible step, the one that gets forgotten.
+
+Each step is **a pull request deployable on its own**. At no point is the system in a
+state where a rollback would break the data.
+
+Step 6 is the most forgotten. It carries a date and an owner, in a *Technical debt*
+issue: no check reads a schema's dates, so the contraction is the project's to track.
+
+---
+
+## 2. Before any migration
+
+| Question | If the answer is missing |
+|---|---|
+| How many rows are affected? | Measure before writing the migration |
+| Does it lock a table? For how long? | Test on a representative volume |
+| Does the old code still work afterwards? | It must, during the deployment |
+| Does the new code work beforehand? | Same, the other way round |
+| What happens to non-conforming data? | Count it, decide explicitly |
+| How do you roll back? | Write the plan, or justify its absence |
+| How will you know it went well? | Define the verification before starting |
+
+---
+
+## 3. Backfill
+
+A backfill over a large volume is an operational procedure, not a script.
+
+- **In batches**, with a pause between batches — never process everything at once.
+- **Idempotent**: re-runnable with no side effect.
+- **Resumable**: remembers its progress, survives an interruption.
+- **Observable**: progress, errors, estimated duration.
+- **Interruptible**: it must be possible to stop it without corrupting the state.
+- **Measured beforehand**: row count, estimated duration, impact on load.
+
+---
+
+## 4. Deleting data
+
+This is irreversible. Mandatory procedure:
+
+```
+1. count exactly what will be deleted
+2. check the selection criterion against a sample
+3. back up or archive what is being deleted
+4. run in dry-run mode first
+5. ask for explicit confirmation, with the exact count
+6. delete in batches, with a stopping point
+7. verify afterwards
+```
+
+A deletion triggered by a retention rule is a product decision: it belongs to a PDR, not
+to a technical task.
+
+---
+
+## 5. Data ownership
+
+Implicit data sharing is the hardest form of coupling to undo, because it is invisible
+in the code.
+
+| Situation | Handling |
+|---|---|
+| A module reads another's table | A violation — detected by a fitness function |
+| Database shared between two modules | ADR required, with explicit ownership per table |
+| Data duplicated across modules | Acceptable when a source of truth is designated and the synchronisation is contractual |
+| A join across domains is needed | A signal of a bad boundary — do not work around it with direct access |
+
+---
+
+## 6. Closing checklist
+
+- [ ] Migration tested on a representative volume
+- [ ] Old and new code both work during the transition
+- [ ] Backfill in batches, idempotent, resumable
+- [ ] Rollback plan written, or its absence justified
+- [ ] Post-migration verification defined **before** the run
+- [ ] Contraction step planned, with a date and an owner
+- [ ] Destructive action explicitly confirmed, with the exact count
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.claude/skills/discovery/SKILL.md b/.claude/skills/discovery/SKILL.md
new file mode 100644
index 0000000..74757ee
--- /dev/null
+++ b/.claude/skills/discovery/SKILL.md
@@ -0,0 +1,135 @@
+---
+name: discovery
+description: 'The project''s discovery rules: turning an idea into a decision — intake, sourced market research, definition, the value hypothesis and no-gos, a challenge by another session (pre-mortem, four risks), then go, clarify or kill. Load this playbook when you are touching: an idea to test, a discovery to challenge or decide.'
+---
+
+
+
+# Playbook — Discovery
+
+> **Trigger.** Load this playbook when you are touching: an idea to test, a discovery to
+> challenge or decide.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/discovery.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Your posture
+
+You run stages 1 to 4 as the **framer**, stage 5 only as the **challenger** — never both in
+the same session. The decider decides, at stage 6. For the framer and the challenger, this
+playbook replaces the kernel's working loop (§2); its closing summary (§8) still applies.
+
+| You do | You never do |
+|---|---|
+| Framer: ask one question at a time, only what you cannot infer | Agree to please; soften an objection |
+| Give every market fact its source | State a fact you cannot source — write it as an assumption |
+| Keep the document to what could change the decision | Fill a canvas, size a market, invent personas |
+| End each round with a decision | Open a new direction before the round is decided |
+
+The engine's `discover` command created `docs/project/discovery.md`: one section per stage,
+each ending with its open questions. When the decider cannot answer now, write the question
+there — most decision-changing first — and go on; never answer it in their place.
+
+---
+
+## 1. Intake
+
+Read the idea file entirely. Restate the idea in one paragraph — for whom, where, which
+problem, what the product does — and ask the decider to correct it. Record the decider in
+the front matter. Until the decider confirms the paragraph, mark it *unconfirmed*: the round
+cannot be decided while it is.
+
+Ask, once, **in which language the project writes** — its documents, its code, its commit
+messages. The idea file may be in one language and the framework's forms in another; nobody
+notices until half the documents are in each. The answer is the project's first rule: one
+line of `docs/project/rules/always.md`, written now, with the idea file left as it was given.
+
+Ask, once, **what has already been asked of, promised to, or received from someone outside the
+team** — a client, a vendor, a partner — by mail, chat or meeting. A fresh session remembers none
+of it, and an outside party asked twice, or asked differently, pays for it in patience. Each answer
+is an entry of the project's log issue, opened now if there is none (`.nstack/handbook/06-decisions.md`
+§9): who, what, when, by which channel — never a secret or a credential, and nothing the outside
+party would not have public in a public repository's issue (`security.md`).
+
+## 2. Research
+
+With the research tools of `.nstack/tooling-profile.md` — or, when that row is empty, the tools
+at hand, named in the document — look for:
+
+- what users do today instead, including nothing;
+- the direct and indirect alternatives, their positioning and their price;
+- the business models of the field;
+- the legal and regulatory constraints, for the countries concerned.
+
+Each finding goes in the evidence table, with what it changes for the idea and its source.
+Prefer the primary source; mark figures a company reports about itself, and claims seen only
+in a search excerpt. A claim without a source goes to *Assumptions*. Stop when each of the
+four points has at least one sourced finding, or an explicit "not found".
+
+**A legal or regulatory claim is read at its primary source — the text itself, the
+regulator's page — or it is an assumption.** A summary of a law by someone who sells a
+product under it is not a source, and a rule the design will rest on is the last thing to
+take second-hand: say "not read" rather than mark it as seen elsewhere.
+
+## 3. Define
+
+With the decider: the users; their problem — quoted from users, saying who and how many,
+since words reported by the decider alone are an assumption; the constraints — who runs it,
+budget, platforms, regulation; and the success signals — what will be observed, and by when,
+if the idea is right. If this stage changes the users or the model, revisit stage 2.
+
+## 4. Shape
+
+- **The value hypothesis** — why a user would switch from what they do today, in one or two
+ sentences, stated so that it can be proven wrong. Not a list of features.
+- **A short press release**, dated launch day — a placeholder if none is set: the user, the
+ problem, the product, one quote, labelled as imagined. Record whether it convinces the
+ decider; if it does not, that is a finding.
+- **No-gos** — what the product deliberately will not do: the decider's, and any the framer
+ proposes, marked *proposed*.
+
+## 5. Challenge — in another session
+
+A session that did not write stages 1 to 4, or a human; it starts once section 1 is
+confirmed — otherwise it names the reading it challenges. The challenger does not interview
+the decider: its questions go into its objections. It reads the idea file and the document,
+then:
+
+1. **Pre-mortem** — the product launched a year ago and failed: the plausible reasons, each
+ tagged with its risk.
+2. **The four risks** — *value*: will they use it, or buy it? *usability*: can they use it?
+ *feasibility*: can it be built with the means at hand? *viability*: does it hold for the
+ business — cost, law, operations? For each, the riskiest assumption and the cheapest test
+ that could refute it: what is done, for how long, and the result that refutes it — a
+ threshold proposed, for the decider to set.
+3. **Counter-evidence** — what contradicts the value hypothesis or the riskiest assumptions:
+ failed products, closed competitors, regulatory refusals. Research as in stage 2 — same
+ tools, same marking, the same stopping rule; an unsourced claim is marked *assumption*.
+4. **Flaws in stages 1 to 4** — each citing the line it objects to.
+
+These are the objections, written in section 5 with the challenger's name and date. Never
+rewrite stages 1 to 4.
+
+## 6. Decide
+
+A framer session presents section 5 unchanged, then the riskiest assumptions and the value
+hypothesis. The decider chooses:
+
+| Decision | What follows |
+|---|---|
+| **go** | The pull request that records the decision writes the front page's sentence (`README.md`) — what the product does, for whom, as the decider confirmed it — and nothing else of that page. The framing then writes the charter from this document (`framing.md`); the tests the decider keeps become spike deliverables of the first cycle |
+| **clarify** | A new round on the open questions, and on the cheap tests the decider picks before any charter; `round` goes up, section 5 is kept under its round, and the changed sections are challenged again |
+| **kill** | The document stays, with its reasons — the cheapest outcome of all |
+
+Section 6 records the reasons, and for a go, why each objection does not block it. Record
+`decision` and `decided_on` in the front matter, then run the fitness functions.
+
+---
+
+## Bounds
+
+A round is one or two working sessions. A second `clarify` is the decider's explicit choice,
+recorded in section 6 — never a default.
diff --git a/.claude/skills/documentation/SKILL.md b/.claude/skills/documentation/SKILL.md
new file mode 100644
index 0000000..2f74950
--- /dev/null
+++ b/.claude/skills/documentation/SKILL.md
@@ -0,0 +1,94 @@
+---
+name: documentation
+description: 'The project''s rules for writing a document: a diagram with its legend first, a few lines after it, a source for every outside claim, a date on every decision, and documents kept current or deleted. Load this playbook when you are touching: a document a human will read, a pull request''s description included: writing or changing one.'
+---
+
+
+
+# Playbook — Documentation
+
+> **Trigger.** Load this playbook when you are touching: a document a human will read, a
+> pull request's description included: writing or changing one.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/documentation.md`
+> — read them with this playbook. They add to it or tighten it.
+
+```mermaid
+flowchart LR
+ Q{"Is there a structure,
a flow or a state
to show?"}:::ask
+ Q -->|yes| D["A diagram
with its legend"]:::first
+ Q -->|no| T["A table,
or three lines"]:::first
+ D --> L["A few lines:
what the diagram
cannot say"]:::then
+ T --> L
+ L --> S["Sources and dates"]:::then
+ S --> C{"Still true
after this change?"}:::ask
+ C -->|no| U["Bring it current
or delete it"]:::stop
+
+ classDef ask fill:#374151,color:#fff
+ classDef first fill:#065f46,color:#fff
+ classDef then fill:#1e3a8a,color:#fff
+ classDef stop fill:#7c2d12,color:#fff
+```
+
+**Legend** — grey: what you ask yourself · green: what the reader sees first · blue: what
+follows it · red: the document that no longer says what is true.
+
+---
+
+## The standard — five rules, and no content
+
+1. **Shape first**: a diagram with its legend before the prose, wherever there is a structure,
+ a flow or a state to show. A reader who stops after the diagram has understood.
+2. **A source for every claim about the outside world** — a market, a law, a tool's
+ behaviour, a number.
+3. **A date on every decision**, and on every criterion that will judge it.
+4. **Current, or deleted.** A stale page costs more than a missing one, because it is
+ believed.
+5. **A fact has one home.** Its home is the file a check or a command reads — a module's
+ manifest for its responsibility, owner and criticality; the cycle for a deliverable's criteria, and its state once the cycle is closed — during it, the
+ hold and the delivery record, which `nstack plan` reads;
+ the charter for the decider. Every other document that needs the fact links to it, never
+ copies it: two copies agree on the day they are written, and only on that day.
+
+The framework asks for this form and writes none of the content: what the document says is
+the project's.
+
+---
+
+## Drawing the diagram
+
+| Situation | Action | Verification |
+|---|---|---|
+| Parts and what links them: modules, users, systems | Boxes and arrows, a dozen boxes at most | Someone reading the diagram alone can say what the document is about |
+| Things that happen in an order | A sequence, left to right or top to bottom | Every step has one way in |
+| Something that changes state | The states and what moves it from one to the next | No state is a dead end unless it is meant to be |
+| A choice between paths | A decision tree, the question in the node | Every branch ends on an action |
+| A colour or a shape is used | It means one thing, and the legend under the diagram says which | The legend names every colour used, and nothing else |
+| The diagram is ready | Written as text in the file, in the notation the tooling profile names — never an image. A drawing of a screen is no diagram: it is an image, frozen (`framing.md` §2) | The pull request shows what changed in it |
+| Nothing to show: one fact, a list, a comparison | No diagram. A table, or three lines | A diagram that decorates is removed |
+| More than a dozen boxes | Two diagrams, one idea each | Each has its own legend |
+
+## After the diagram
+
+- **Say what the diagram cannot**: the why, the exception, the number. Never describe the
+ diagram in words.
+- **A table for anything a reader will compare**; a list for anything they will tick.
+- **The point first.** A reader who must scroll to find what was decided has been given a
+ story instead of a document.
+- **Short.** A paragraph a reader skips is a paragraph to delete.
+
+## Which document, and when
+
+Each document of a project has the event that makes it writable; before it, its form stays
+a form. The table is `.nstack/handbook/06-decisions.md` §10 — read that one section before writing a
+document the project does not hold yet, and never fill a form with what nobody has decided.
+
+---
+
+## Closing checklist
+
+- [ ] The diagram comes first, with its legend — or there is nothing to draw, and no diagram
+- [ ] Every claim about the outside world names its source
+- [ ] Every decision and every criterion carries its date
+- [ ] Every document this change makes untrue is brought current in the same pull request
diff --git a/.claude/skills/framing/SKILL.md b/.claude/skills/framing/SKILL.md
new file mode 100644
index 0000000..8067410
--- /dev/null
+++ b/.claude/skills/framing/SKILL.md
@@ -0,0 +1,227 @@
+---
+name: framing
+description: 'The project''s framing rules: interviewing the decider, writing the charter, planning a bounded cycle with its deliverables, acceptance criteria and appetite, handling new ideas, and closing a cycle at its end or at its circuit breaker. Load this playbook when you are touching: framing a project, planning or closing a cycle.'
+---
+
+
+
+# Playbook — Framing
+
+> **Trigger.** Load this playbook when you are touching: framing a project, planning or
+> closing a cycle.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/framing.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## When framing is worth it
+
+A project is **unframed** until its charter is accepted: a stage, not a fault. Every rule
+judges its changes except the three that bound work inside a cycle. Framing buys an
+appetite, an end date, a circuit breaker and a decider — worth their price **when there is
+something to bound**: several people, a deadline, a decider who is not the one typing. Say
+so when you are asked to frame a project where none of the three is true; then frame it if
+the decider still wants it. Never frame to make a check pass: no check asks for it.
+
+## Your posture
+
+You are the **framer**. You propose; the decider decides. For the framer, this playbook
+replaces the kernel's working loop (§2); its closing summary (§8) still applies.
+
+| You do | You never do |
+|---|---|
+| Interview the decider, one subject at a time | Decide in their place, or fill a gap with an invention |
+| Propose the field's convention by default, marked *(framer, to confirm)* with its source | Propose more than the need |
+| List the open questions, blocking apart | Let a charter or a cycle be accepted with a blocking question open |
+| Keep the first cycle small | Split into many modules on day one (`.nstack/handbook/02-modules.md` §3) |
+
+A proposal without a source is an open question, not a proposal. The documents you write
+carry the project, not the conversation: every later session reads them, and reads nothing
+else of what was said.
+
+---
+
+## 1. Frame the project: the charter
+
+Start from what the decider gives you. When `docs/project/discovery.md` exists, its decision
+must be **go**: the charter reuses its users, problem, constraints, success signals, no-gos
+and risks, carries its unanswered questions into its own, and you ask only what it leaves
+open. Otherwise — an idea alone — propose a discovery first (`discovery.md`); a specification
+already challenged can be framed directly. Read the source entirely, then interview, one
+subject at a time, asking only what you cannot infer:
+
+| Subject | Ask | The charter records |
+|---|---|---|
+| Users | Who uses it, in what situation, with what problem? | The users and their problem |
+| Outcome | What must be true for the project to be finished? | Success criteria, measurable, dated — or relative to a named event, such as launch day, that a later framing dates |
+| Constraints | Law, money, security, data, platforms, deadlines | The constraints |
+| Risks | What could make it fail, or cause harm? | The risks, and the criticality they imply — what a failure of each module would cost, which the decider settles and `.nstack/handbook/05-workflow.md` §7 prices |
+| Vocabulary | The domain's words, and what each one means | The vocabulary |
+| Not this project | What it will deliberately not do | Out of scope |
+| Outside the team | What has already been asked of, promised to, or received from someone outside the team — a client, a vendor, a partner — by any channel? When the discovery asked it, only what changed since; otherwise, in full | Nothing in the charter: each answer is an entry of the project's log issue (`06-decisions.md` §9) |
+
+A domain that moves money, handles personal data or acts on someone's behalf raises the
+criticality of the modules concerned, and `security.md` applies from the first cycle — to
+the code, and to the data a spike collects: who sees it, how long it is kept. Say so to the
+decider.
+
+**Before proposing a criticality, read the rule** — the last paragraph of
+`.nstack/handbook/05-workflow.md` §7: a module that holds a key, places an order, moves money or
+touches someone's personal data is `critical`. Propose what the rule says, with what each
+value costs; a lower value is the decider's to choose, and is written as a deviation with its
+reason and the event that ends it.
+
+When no discovery came first, ask too **in which language the project writes**; the answer is
+its first rule (`docs/project/rules/always.md`).
+
+**A constraint that binds how the work is done becomes a rule of the project**, proposed
+with the charter: one line of `docs/project/rules/.md`, from
+`.nstack/forms/rules.md` — the subject is the playbook it completes, `always` when
+it applies to every task. It names its source in the charter and how it is checked. Never
+write it into a playbook or the kernel: those are every project's, and the next update
+would conflict on it.
+
+Write `docs/project/charter.md` from `.nstack/forms/charter.md`, with
+`status: proposed` and the open questions at the end, then run the fitness functions.
+"Finished" means the charter's goal is reached: framing stops; running what was built may go
+on.
+
+## 2. Plan a cycle
+
+1. **Goal** — one sentence, the one outcome of this cycle.
+2. **Deliverables** — a finite list, `D1`, `D2`…, each an outcome a user can observe — for a
+ spike, the question it answers for the decider. Each gets acceptance criteria, written
+ *given · when · then*; they become its test sheet (`verification.md`).
+
+ **Two questions to ask of each one, before writing its criteria:**
+ - *Can the team finish it alone, inside this cycle?* If it waits on someone outside the
+ project — a reply, an opinion, a decision elsewhere — it is a **dependency with a date**,
+ not a deliverable. Name it in the risks and give it a date; the cycle does not hold it.
+ - *Is its product knowledge rather than code?* Then it is a **spike**, and its criteria say
+ **what will be recorded** and **the threshold it is read against** — never that the answer
+ comes out a particular way. **A refuted result is a delivered one.** "Five people were
+ asked, one acted, below the threshold of two" closes the deliverable; it does not fail it.
+ When its product is a **drawing** — the screens, the journey the user will see — the
+ drawing is committed under `docs/project/drawings/-/` with its date,
+ and frozen: what the decider accepts in it becomes criteria of the deliverable that
+ builds it, and once built, the product and its screenshots are the truth. A new round is
+ a new folder, never an update.
+
+ A criterion nobody can meet is not met. It is answered with something that looks like proof,
+ and that answer is reviewed and merged like the rest.
+3. **Unknowns** — a blocking unknown becomes a *spike* deliverable, whose output is
+ knowledge (`.nstack/handbook/05-workflow.md` §3). After a discovery's go, the tests the decider kept
+ are the first cycle's spikes.
+4. **Modules** — name each deliverable's module; a spike run outside the code — a sign-up
+ form, interviews, a measure whose product is a record and not shipped code, even about one
+ module — has none (`module: null`): no merge carries it, so `nstack deliver` has nothing to read. Propose a new module only against the tree of
+ `.nstack/handbook/02-modules.md` §3: one module is often enough to start.
+5. **Appetite** — ask the decider how many weeks they **want** to spend, not how long it
+ will take — in days for a cycle shorter than a week, such as an engagement whose date an outside
+ party sets (`appetite_days`), never rounded up to a week nobody agreed to. When the deliverables
+ do not fit, cut the scope; never stretch the appetite.
+6. **Out of scope and later** — out of scope is not done even if time remains; *later* holds
+ the candidates for the next framing.
+
+Write `docs/project/cycles/NN-.md` from `.nstack/forms/cycle.md`, with
+`status: proposed` and `end` = `start` + the appetite, then run the fitness functions.
+
+## 3. Hand over to the decider
+
+A cycle's *What needs a person* holds what only a person can do, each with its literal gesture: fill it
+while framing, and keep it true. It is what `nstack plan` opens with. A request to someone outside
+the team starts from the log issue's entries, and from the decider's answer to what has been asked,
+promised or received outside since the last one — every cycle, not only the first: nothing already
+asked is asked again, nothing is asked more broadly than before without saying why, and each new
+request becomes an entry. One still awaiting a reply that a deliverable needs is a dependency with a date.
+
+Present the charter, the cycle, the open questions, what went to *later*, and what you are
+unsure of — the cycle also as the board will show it: `nstack board --dry-run` previews the
+milestone and the issues its acceptance would create, and what it would collide with, and makes
+none; put the lines under *On acceptance of cycle …* in the framing pull request's description. The decider amends; the framer sets `status: accepted` — on the charter, then on the
+cycle — in a pull request the decider approves, and that approval is their gesture; accepted after `start`, the cycle's `start` and `end`
+move in the same pull request. **The next cycle, accepted while one runs**, stays `proposed` — one
+accepted cycle at a time (C5) — and gains `accepted_on: `: `nstack plan` stops asking
+for it while that cycle runs, and the running cycle's closure starts it (§5). The modules accepted there are created with the engine's
+module scaffolding, declared user-facing when a user sees them.
+
+**Where the project's own rules waive approval** — an agent merging alone on an attested,
+verified head, `doctor`'s G2 taken knowingly — nobody approves that pull request, and the
+decider's word stands for the approval: quoted in the page it accepts (the charter, the cycle),
+with its date and where it was said — a comment, a message, a meeting's note. The same holds
+for a deliverable accepted below. Without that line, the acceptance is the agent's alone.
+
+**The pull request that accepts the charter writes the project's front page from it** —
+`README.md`: a diagram of who uses the product and what it talks to, how to run what exists,
+and the sentence when no discovery wrote it. Until then that page holds its sentence at most;
+from then on the plan check refuses an accepted charter over a form left as it came
+(`.nstack/handbook/06-decisions.md` §10, `documentation.md`).
+
+## 4. During the cycle
+
+- **A new idea** goes to *later*. It enters the cycle only if the decider re-frames:
+ swapping a deliverable out, adding one they judge fits what is left of the appetite —
+ the end date does not move — or closing the cycle early. An added deliverable takes its
+ criteria like the others, and its section says on whose word and on what it entered.
+- **An urgent fix** outside the cycle — an incident, a production defect — goes in a pull
+ request with the `out-of-cycle` label and the line `Out of cycle: `.
+- **A deliverable's state** is written in the cycle file at framing (`proposed`, then `ready`:
+ testable criteria, set by the framer, confirmed when the decider accepts the cycle), on a
+ re-framing (`deferred`, `dropped`), and at the closure (`accepted`, by
+ `nstack deliver --write-states`) — never during delivery, and never in a delivery's pull request.
+ In between, `nstack plan` reads it: *held* from its claim, *delivered* from its record
+ (`nstack deliver D --held '#'`, kernel §2 step 12, `.nstack/handbook/project.md`);
+ it asks the decider nothing. It is accepted when each of its criteria is held by a scenario of a merged sheet, or by an
+ answer in the acceptance issue the cycle names beside the state (`.nstack/handbook/05-workflow.md`
+ §7); a criterion only a person can try waits for that answer. A spike outside the code is held
+ by a decision record when it binds the project (*Decisions* below), otherwise by a line of the
+ log issue it was run under — the project's, or its module's —, which its section links: with no merge it has no record, and the closure
+ writes its `accepted` by hand beside the states `--write-states` wrote, citing that line. Where
+ approval is waived (§3), the decider's word is quoted once, at the closure, for the cycle. A rule
+ sees that a merge exists, not that a criterion holds: the closure reads the records before it
+ writes.
+
+## 5. The end of a cycle
+
+**Every deliverable delivered or accepted** — `nstack deliver --write-states`, and `nstack plan --prune` for the empty start branches a deferred deliverable left, then write the closure: what was delivered, which success
+criteria moved, what was deferred, and **which documents the cycle brought current** — the
+front page and the module map first, each with its pull request; set `status: closed`,
+`outcome: completed`, `ended_on`. A next cycle carrying `accepted_on` is set `status: accepted` in the
+same pull request; its `start` becomes the closure's day when it is not, and its `end` follows the appetite.
+A success criterion the decider says moved is recorded under `success:` in the front matter, at
+any closure — by its number in the charter, `met`, or `observing` with the day observation
+started; the latest record is its state, and `nstack plan` counts the criteria met.
+When a spike refutes what the charter rests on, present stopping the project too.
+
+**The end date reached first** — the circuit breaker: nothing is extended. Present the
+three choices, with the state of every deliverable. Whichever is chosen, `nstack deliver --write-states` comes
+first, while the cycle is still accepted: it is what brings the records into the cycle file.
+
+| The decider chooses | `status` | `outcome` |
+|---|---|---|
+| Ship what is delivered or accepted | `closed` | `shipped` |
+| Frame a new cycle, with a new appetite | `stopped` | `reframed` |
+| Stop the project | `stopped` | `stopped` |
+
+A next cycle carrying `accepted_on` starts here only on `shipped`, as on a completed closure. On `reframed` or
+`stopped`, the word was given for another situation: it stays `proposed`, and `nstack plan` asks the decider again.
+
+The closure is where the next framing starts. When `nstack plan` says the charter's goal is
+reached — every success criterion met —, present it: the decider says whether the project is
+finished.
+
+## Decisions
+
+A decision lives in a record, never in the charter, the cycle or a conversation
+(`.nstack/handbook/06-decisions.md`): one register of each kind at the project's root —
+`docs/pdr/` for the product, `docs/adr/` for the technique — and `Scope: module ` when it
+concerns one module.
+
+| When | Then |
+|---|---|
+| An accepted charter has to change — a constraint, a user, what the project is not | A **PDR** first, which the change cites; the charter is never rewritten in place (CI warns, C9) |
+| The framing chooses a module, a stack, a contract | An **ADR**: the module's creation decision is one |
+| A spike's result binds the project | A PDR or an ADR; otherwise a line in the project's log issue |
+| A cycle's **closure** | Read every decision the plan names as due (C10): its criterion names this cycle, or a date in bold, `**YYYY-MM-DD**`, its end reached. The record gains one line under its criterion, *Read at 's closure, : met \| missed \| superseded*, and nothing else; a *missed* one is the decider's to answer, by a new record or the removal condition |
diff --git a/.claude/skills/operations/SKILL.md b/.claude/skills/operations/SKILL.md
new file mode 100644
index 0000000..5c13a96
--- /dev/null
+++ b/.claude/skills/operations/SKILL.md
@@ -0,0 +1,184 @@
+---
+name: operations
+description: 'The project''s operations and reliability rules: timeouts, retries, structured logs, metrics, alerts, health checks, rollback and controlled degradation. Load this playbook when you are touching: logs, metrics, alerts, retries, timeouts, rollback, a deployment, a call to another system.'
+---
+
+
+
+# Playbook — Operations and reliability
+
+> **Trigger.** Load this playbook when you are touching: logs, metrics, alerts, retries,
+> timeouts, rollback, a deployment, a call to another system.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/operations.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Absolute rules
+
+| # | Rule |
+|---|---|
+| OPS1 | **Never an automatic retry without analysing the side effects.** |
+| OPS2 | **Every external call has an explicit timeout.** A call without one is an outage waiting to happen. |
+| OPS3 | **No secret and no personal data in the logs.** |
+| OPS4 | **An error quietly swallowed is a future incident.** |
+| OPS5 | **A module in production with no way of knowing it is unwell is not ready.** |
+
+---
+
+## 1. Retries — the classic trap
+
+```mermaid
+flowchart TD
+ A["Considering a retry"] --> B{"Is the operation
idempotent?"}
+ B -->|No| C["DO NOT RETRY.
Make it idempotent first,
with an idempotency key"]
+ B -->|Yes| D{"Is the error
transient?"}
+
+ D -->|"No: 4xx, validation,
authorisation"| E["DO NOT RETRY.
The result will be identical."]
+ D -->|"Yes: network, 5xx,
timeout"| F{"Exponential backoff
with jitter?"}
+
+ F -->|No| G["DO NOT RETRY.
A synchronised retry turns
a local incident into a global outage"]
+ F -->|Yes| H{"Maximum count
and total budget
defined?"}
+
+ H -->|No| G
+ H -->|Yes| I["Retry acceptable,
with a metric on the retry rate"]
+
+ style C fill:#7c2d12,color:#fff
+ style E fill:#7c2d12,color:#fff
+ style G fill:#7c2d12,color:#fff
+ style I fill:#065f46,color:#fff
+```
+
+**Legend** — red: do not retry, and why · green: the only branch where a retry is safe.
+
+Three side effects to check every time:
+
+- **Duplication** — a retry on a non-idempotent operation applies the effect twice.
+- **Amplification** — N clients retrying at the same time multiply the load on a service
+ already in trouble.
+- **Masking** — a retry that succeeds hides a real degradation. The retry rate is
+ therefore a metric, not an implementation detail.
+
+---
+
+## 2. Timeouts
+
+| Rule | Why |
+|---|---|
+| Every external call has an explicit timeout | A call without one blocks a thread indefinitely |
+| The timeout is shorter upstream than downstream | Otherwise the caller gives up before the callee, and the work is lost |
+| A total budget exists for the request | Prevents cascading timeouts from accumulating |
+| The timeout is a configured value, not a buried constant | It will need adjusting in production |
+
+---
+
+## 3. Logs
+
+| Do | Avoid |
+|---|---|
+| Structured, machine-readable | Concatenated strings nothing can parse |
+| A correlation identifier propagated | Logs impossible to tie together |
+| Useful context: what, where, which identifier | "Error" with no context |
+| Consistent levels, actually respected | Everything at `info`, or everything at `error` |
+| Masking sensitive data **at the source** | Masking at display time |
+
+A log that does not let you reconstruct what happened has only occupied disk space.
+Control question: *at 3 a.m., does this log let me understand without reading the code?*
+
+---
+
+## 4. Metrics and alerts
+
+| Type | Example |
+|---|---|
+| Traffic | Requests, messages processed |
+| Errors | Error rate, by type |
+| Latency | The distribution, not only the mean |
+| Saturation | Queue, connections, memory |
+| Business | What the module is supposed to produce |
+
+**The mean hides everything.** A healthy average latency can conceal 5 % of users waiting
+ten seconds. Always look at the distribution.
+
+### Alerts
+
+| Rule | Reason |
+|---|---|
+| Alert on a **user-visible symptom**, not on a technical cause | Causes change, the symptom stays relevant |
+| Every alert is **actionable** | An alert with nothing to do will be ignored |
+| Every alert points to a **runbook** | Otherwise the knowledge sits in one person's head |
+| An alert that fires with no action taken is **removed or fixed** | Noise destroys the value of every alert |
+
+---
+
+## 5. Health checks
+
+| Type | Answers | Trap |
+|---|---|---|
+| *Liveness* | Should the process be restarted? | Must **not** depend on external dependencies — otherwise an external outage causes a restart loop |
+| *Readiness* | Can it take traffic? | Must check the critical dependencies |
+| *Startup* | Has it finished starting? | Avoids restarts during a slow initialisation |
+
+---
+
+## 6. Deployment and rollback
+
+```mermaid
+flowchart TD
+ A["Change ready"] --> B{"Compatible with
the previous version?"}
+ B -->|No| C["Split it: make it compatible
first, then switch over"]
+ B -->|Yes| D["Deploy"]
+ D --> E["Smoke tests"]
+ E --> F{"Green?"}
+ F -->|No| G["Immediate ROLLBACK"]
+ F -->|Yes| H["Verification through
observability:
errors · latency · business"]
+ H --> I{"As expected?"}
+ I -->|No| G
+ I -->|Yes| J["Done"]
+
+ style G fill:#7c2d12,color:#fff
+ style J fill:#065f46,color:#fff
+ style C fill:#1f2937,color:#fff
+```
+
+**Legend** — red: roll back · green: done · dark grey: split the change instead.
+
+- **Rollback is tested**, not assumed. A rollback never executed probably does not work.
+- **A deployment is not finished at deploy time**: it is finished when observability
+ confirms the expected behaviour.
+- **Backward compatibility is mandatory**: during the deployment two versions coexist. An
+ incompatible change is split up (`.nstack/handbook/03-contracts.md`).
+
+---
+
+## 7. Controlled degradation
+
+Decide **in advance** what happens when a dependency is unavailable:
+
+| Strategy | When |
+|---|---|
+| Fail cleanly | The feature makes no sense without the dependency |
+| Serve a default value | An approximation beats nothing |
+| Serve from a cache, even a stale one | Freshness matters less than availability |
+| Disable the feature, keep the rest | The dependency is secondary |
+| Queue for deferred processing | The operation can be asynchronous |
+
+The choice is explicit and tested. Without a prior decision, the default behaviour is
+always the worst one: an opaque error at the worst possible moment.
+
+---
+
+## 8. Closing checklist
+
+- [ ] Explicit timeouts on every external call
+- [ ] Retries justified, idempotent, with backoff and a ceiling — or absent
+- [ ] Logs structured, correlated, free of secrets and personal data
+- [ ] Errors never swallowed quietly
+- [ ] Metrics and alerts actionable, pointing at a runbook
+- [ ] Health checks correct (liveness with no external dependencies)
+- [ ] Backward compatibility verified
+- [ ] Rollback documented and tested
+- [ ] Behaviour on unavailability decided explicitly
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.claude/skills/pause-and-resume/SKILL.md b/.claude/skills/pause-and-resume/SKILL.md
new file mode 100644
index 0000000..fd3fe6a
--- /dev/null
+++ b/.claude/skills/pause-and-resume/SKILL.md
@@ -0,0 +1,90 @@
+---
+name: pause-and-resume
+description: 'The project''s rules for ending and resuming a session: work committed and pushed before stopping, nothing left running, holds kept, a short resume note in .nstack/local/, and a restart that reads the note, renews its holds and runs nstack plan once. Load this playbook when you are touching: stopping, restarting, handing work over, or resuming a session.'
+---
+
+
+
+# Playbook — Pause and resume
+
+> **Trigger.** Load this playbook when you are touching: stopping, restarting, handing work over,
+> or resuming a session.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/pause-and-resume.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## The rule: the repository holds the state, a note points into it
+
+```mermaid
+flowchart LR
+ S["Stop
work pushed, tree clean"] --> N["Note
.nstack/local/resume.md"]
+ N -. restart .-> R["Resume
read the note, renew holds"]
+ R --> P["nstack plan, once"] --> G["the noted gesture"]
+ classDef state fill:#1f2937,color:#fff
+ class S,R state
+```
+
+*Legend: solid arrows are what you do in order; the dotted one is the session ending.*
+
+A session ends without warning: a restart, a full context, a person's evening. What it knew must
+already be where the next one reads it — commits, pull requests, holds — and the next one must
+not have to re-read the history to find it. A note of a few lines says where to look; it never
+replaces what it points to.
+
+Your tool's own memory, a chat summary or a transcript are extras: useful to you, invisible to
+another tool and to another person. The source is the repository and the forge.
+
+---
+
+## Stop
+
+Before you stop, or when you are told the session will end:
+
+1. **Nothing only in the working tree.** Commit what is in progress, on its work branch, and push
+ it: the pushed branch shows it, and on GitHub the claim's draft pull request too when the work
+ is on its first branch. A commit or a push a hook refuses: fix its cause; what you cannot fix
+ before stopping stays as it is, and the note names it with the refusal — never `--no-verify`.
+2. **Nothing running.** No background job, watcher or server left for the next session to find.
+3. **Nothing left over.** Scratch clones, worktrees and local branches of your own that hold no
+ work are removed; a worktree that holds work is pushed first. Never the start branch your
+ claim made: `nstack deliver` removes it.
+4. **Holds stay.** A deliverable you will resume stays held (`nstack plan` shows it). Past
+ `hold_days` without work, anyone may take it over: give back with `nstack unclaim` what you
+ will not resume by then.
+5. **Write the note.**
+
+## The note
+
+`.nstack/local/resume.md` — one per clone, never committed (`.nstack/local/` is ignored).
+Fifteen lines at most; over that, it repeats what the repository already says. Rewrite it
+whole at each stop: it states the present, not a journal.
+
+```markdown
+# Resume — 2026-11-24 18:40, session , for
+- Merged since the last note: D30 (#41)
+- Open: D31, pull request #44 — next: answer the verifier's finding on the empty state; mine
+- Open: D32, branch d32-export, pushed, no pull request yet — next: the test sheet; mine
+- Owed by others: the decider's approval of #42; the verifier's run of #44
+- Not pushed: (nothing) — or the commit, the files, and the hook's refusal
+- Next id: D33
+- Relaunch: nstack agent run --
+```
+
+Handing over to another session or person: give them the note's text with the hand-over, and
+give the hold back (`nstack unclaim`) for them to claim. Never hand over a clone.
+
+## Resume
+
+1. **Read the note, and only the note.** Not the history, not the transcripts. No note: `git
+ status`, `git log` of your branches and `nstack plan` say the same, more slowly.
+2. **Renew your holds** under this new session. In `nstack agent run`:
+ `nstack claim --person --session ` renews a hold your own agent
+ held. Outside it, a new session of yours takes its hold over, on your person's word:
+ `nstack claim --take-over --person --session `
+ (`.nstack/handbook/project.md`, *Who holds a deliverable*).
+3. **`nstack plan`, once**: what changed while you were away — merges, holds, what turned stale.
+ Where it disagrees with the note, the repository is right; the note was the past.
+4. **Continue at the noted gesture.** A gesture owed by someone else is not yours to redo.
diff --git a/.claude/skills/security/SKILL.md b/.claude/skills/security/SKILL.md
new file mode 100644
index 0000000..4f7dec9
--- /dev/null
+++ b/.claude/skills/security/SKILL.md
@@ -0,0 +1,134 @@
+---
+name: security
+description: 'The project''s security rules: authentication, authorisation, secrets, input validation, personal data, dependencies and high-risk actions. Load this playbook when you are touching: authentication, authorisation, secrets, personal data, external input, a new dependency.'
+---
+
+
+
+# Playbook — Security
+
+> **Trigger.** Load this playbook when you are touching: authentication, authorisation,
+> secrets, personal data, external input, a new dependency.
+>
+> Format: `situation → action → verification`. Anything not verifiable here must go to
+> human review.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/security.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Absolute rules
+
+| # | Rule |
+|---|---|
+| SEC1 | **No secret in the repository.** Not in clear text, not encoded, not "temporarily", not in a test, not in a comment. |
+| SEC2 | **All external input is hostile** until explicitly validated. |
+| SEC3 | **Least privilege by default** — including for CI and for agents. |
+| SEC4 | **Deny by default** in authorisation: whatever is not explicitly allowed is forbidden. |
+| SEC5 | **Never design your own** cryptographic, password-hashing or authentication mechanism. The established convention, always (Prior Art Gate). |
+
+If one of these rules has to be broken, this is no longer a development task: it is a
+decision, and it goes through an ADR and human approval.
+
+---
+
+## Authentication
+
+| Situation | Action | Verification |
+|---|---|---|
+| New entry point | Check it is covered by the existing mechanism, not a new one | Test: unauthenticated call → refused |
+| Password storage | A slow, standard hashing algorithm, never a homemade one | Test on the algorithm used |
+| Session or token | Expiry, revocation and rotation planned | Test: expired token → refused |
+| Authentication error message | Never reveal whether the account exists | Test on the message content |
+
+---
+
+## Authorisation
+
+This is the most frequent source of vulnerabilities, and the easiest to test.
+
+| Situation | Action | Verification |
+|---|---|---|
+| New endpoint or action | Decide explicitly who is allowed | Test per role: allowed, not allowed, not authenticated |
+| Access to a resource by identifier | Check ownership, not only the role | Test: user A reaches B's resource → refused |
+| List or search | Filter server-side, never client-side | Test: the response contains no one else's data |
+| Privilege escalation possible | Treat it as a high-risk action | Test + logging + human review |
+
+> **The most common trap.** Hiding a button in the interface is not an authorisation.
+> Every access rule exists server-side, and is tested there.
+
+---
+
+## Secrets
+
+| Situation | Action | Verification |
+|---|---|---|
+| A secret is needed | Environment variable or vault — never the code | Automated detection in CI |
+| Secret exposed, even briefly | **Rotate immediately.** Removing it from the commit is not enough | An incident, not a simple fix |
+| Secret in a test | A fake value explicitly named as such | Diff review |
+| Log containing a secret or a token | Mask at the source, not at display time | Test on the log content |
+
+---
+
+## Input and data
+
+| Situation | Action | Verification |
+|---|---|---|
+| User input | Validate structure, type, bounds, format — then sanitise | Test with invalid, empty, overlong, malformed input |
+| Query to a database | Parameterised queries, never concatenation | Injection test |
+| Displaying supplied content | Escape at render time, appropriately for the context | XSS test |
+| File upload | Type, size, extension, storage outside any executable area | Test with a hostile file |
+| Personal data | Minimise, encrypt at rest when sensitive, log access | Review + data inventory |
+| Application log | No personal data and no secret | Test on the log content |
+
+---
+
+## Dependencies and supply chain
+
+| Situation | Action | Verification |
+|---|---|---|
+| New dependency | Niche filter (`.nstack/handbook/06-decisions.md` §3) + declared in the manifest | Review: undeclared dependency (to automate) |
+| Reported vulnerability | Handle it by severity and real exposure, not by score alone | Automated analysis in CI |
+| Unmaintained dependency | Open a *Technical debt* issue with the exit strategy | Dependency review |
+
+---
+
+## Exposure and abuse
+
+| Situation | Action |
+|---|---|
+| Expensive public endpoint | Rate limiting, from the first version |
+| Sensitive operation | Auditable logging: who, what, when, from where |
+| Error returned to the client | A generic message; the detail goes to the logs |
+| Internal resource | Not exposed by default; exposing it is a decision |
+
+---
+
+## High-risk actions
+
+Changing permissions, accessing secrets, a change touching authentication, exposing a
+new service, an irreversible migration.
+
+**Mandatory procedure — never a silent execution:**
+
+```
+1. name the risk and its blast radius
+2. describe the state before / after
+3. propose the safe procedure and the rollback
+4. ask for explicit confirmation
+```
+
+---
+
+## Closing checklist
+
+- [ ] No secret added, in any form
+- [ ] Authorisation tested by role **and** by ownership
+- [ ] Input validated and sanitised, with negative tests
+- [ ] Logs free of secrets and personal data
+- [ ] Error messages uninformative to an attacker
+- [ ] New dependencies declared and filtered
+- [ ] High-risk actions explicitly confirmed
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.claude/skills/tests/SKILL.md b/.claude/skills/tests/SKILL.md
new file mode 100644
index 0000000..7408b9b
--- /dev/null
+++ b/.claude/skills/tests/SKILL.md
@@ -0,0 +1,218 @@
+---
+name: tests
+description: 'The project''s test strategy: choosing the test level, writing the oracle, edge cases, doubles and handling flaky tests. Load this playbook when you are touching: a non-trivial test strategy, a flaky test.'
+---
+
+
+
+# Playbook — Tests
+
+> **Trigger.** Load this playbook when you are touching: a non-trivial test strategy, a
+> flaky test.
+>
+> For an ordinary task the kernel rule is enough: **write the oracle, watch it fail,
+> implement**.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/tests.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## 1. Choosing the test level
+
+```mermaid
+flowchart TD
+ A["Behaviour to verify"] --> B{"Is it a pure
business rule?"}
+ B -->|Yes| U["UNIT TEST
fast, numerous, edge cases"]
+ B -->|No| C{"Does it cross a
module boundary?"}
+
+ C -->|Yes| CT["CONTRACT TEST
on both sides"]
+ C -->|No| D{"Does it depend on
real infrastructure?"}
+
+ D -->|Yes| I["INTEGRATION TEST
targeted, minimal scope"]
+ D -->|No| E{"Is it a critical
user journey?"}
+
+ E -->|Yes| E2["E2E — only when
genuinely critical"]
+ E -->|No| U
+
+ style U fill:#065f46,color:#fff
+ style CT fill:#065f46,color:#fff
+ style E2 fill:#7c2d12,color:#fff
+```
+
+**Legend** — green: the levels to prefer · red: the level to use sparingly.
+
+Preference rule: **the lowest level that actually verifies the behaviour**. An E2E test
+that could have been a unit test costs a hundred times more, breaks ten times more
+often, and diagnoses ten times worse.
+
+A scenario replayable end to end belongs in the module's `e2e` command, and its evidence in
+`.evidence/`: CI keeps it for the test sheet (`.nstack/handbook/05-workflow.md` §7) — where checks are
+attested, the verifier's evidence branch (`verification.md`, *Evidence*).
+
+**What the run said.** `nstack e2e` gives the run a folder of its own, `$NSTACK_EVIDENCE`
+(`/.evidence/e2e/`), keeps there the command's output — a traceback included — and then
+reads the log files the run wrote there:
+
+- **Write there** the module's logs (`.log`, `.jsonl`) and screenshots; data that are not logs —
+ recordings, events — elsewhere. A page's uncaught errors and console errors reach a log there:
+ logged by the page itself through the application, or collected by a script the scenario
+ injects (`window.onerror`, `unhandledrejection`) — some drivers expose no console.
+- **The audit** reads each line's level — JSON keys, `level=`, a level word leading the line, or
+ the module's `evidence.levels` expression. A warning or an error the module did not declare is
+ quoted with `file:line` and the declaration that would accept it: an error fails the run, a
+ warning fails from criticality `high` and is reported below. The first NapkinStack version that
+ brings the audit only reports; the project's next minor version judges.
+- **Declare** what the scenarios provoke on purpose, in the manifest — a pattern, its level, the
+ scenario that provokes it (M12). The manifest is the one place the audit reads: a warning or
+ an error a scenario provokes is declared there, even when the scenario asserts it too. A module
+ that declares lines and whose run wrote no log into `$NSTACK_EVIDENCE` fails when judged — they
+ were checked against nothing.
+- **Not run here.** A run that cannot run on this machine — no desktop, no sound server — says
+ why on its output and exits 77, the code Automake and Meson read as a skipped test: the run is
+ recorded *not run here*, what it logged is shown and nothing judged, and it passes. Exit 0 means
+ it ran; 77 for any other reason — some tools use it for a refused permission — reads as *not
+ run*, so a run that fails exits with another code.
+
+- **One run at a time, unless sealed.** What an end-to-end run drives — a sound server, a
+ display, a port — is the machine's, so `nstack e2e` runs one at a time on a machine, and a run
+ that waits says for whom, every minute. A module whose run shares nothing with another run
+ declares `evidence.sealed: true`: its run neither waits nor holds the machine. Declare it only
+ when each of these is true — two runs that share one of them see each other's state, and fail
+ for no reason of their own:
+
+ | Not shared | How to check |
+ |---|---|
+ | Session and devices: display, sound server, session bus | its run starts them, headless, and passes their address to what it drives (`DISPLAY`, `PULSE_SERVER`, `DBUS_SESSION_BUS_ADDRESS` from `dbus-run-session`) |
+ | Ports | each server binds port 0 itself and reports the port it got; never a fixed number, nor one picked and released before the server binds it |
+ | Files: build output, temporary files, sockets, state, configuration | everything it writes goes under a folder of its own run — the build tool's output folder set per run (`CARGO_TARGET_DIR`, not `build-dir`), `TMPDIR`, `HOME` and `XDG_*_HOME` pointed there —, never a fixed path |
+ | Processes | its teardown stops what it started — a process group it created (`setsid`, `start_new_session`), or the PIDs it recorded for a daemon that detaches — never by name or executable path |
+ | Per-user kernel limits: file watchers (inotify instances and watches), process count | its run closes what it opens, and as many runs as the machine takes at once stay under the user's limits (`fs.inotify.max_user_instances`, `fs.inotify.max_user_watches`, `ulimit -u`, which counts threads too); a limit run out fails at once, naming it — no folder of its own run isolates these |
+ | Timings, whatever the load | it passes with the machine busy; a run that waits for a quiet machine is the opposite of sealed |
+
+ The lock keeps unsealed runs apart, not sealed ones: a run that needs a quiet machine cannot get
+ one from the lock while sealed runs go beside it.
+
+```yaml
+evidence:
+ provoked:
+ - pattern: "key refused"
+ level: warning
+ scenario: S3
+ sealed: true # every row of the table above holds: runs beside any other
+```
+
+---
+
+## 2. The oracle
+
+| Requirement | Why |
+|---|---|
+| Written **before** the implementation | Otherwise it is written to pass, not to verify |
+| Watched **failing** first | A test never seen red may test nothing |
+| Fails for the **right reason** | A compilation failure is not a test failure |
+| Named after the **behaviour**, not the function | `refuses_an_order_without_stock`, not `test_create_order_2` |
+
+### When the oracle is impossible
+
+| Cause | Response |
+|---|---|
+| Subjective criterion | Restate it as an observable behaviour |
+| Exploratory task | Requalify it as a *spike*: the deliverable is knowledge |
+| Untestable area | Make it testable first, as a separate task |
+| Vague need | Back to framing — it was not *Ready* |
+
+In every case: **do not generate while waiting.**
+
+---
+
+## 3. What to test first
+
+```
+1. business rules 2. critical journeys 3. permissions
+4. contracts 5. errors 6. edge cases
+7. regressions that happened 8. high user impact
+```
+
+**Every regression fixed gets a test** that failed before the fix. That is the only
+guarantee it will not come back quietly.
+
+**Do not aim at a coverage percentage.** Coverage tells you what is not tested; it never
+tells you that what is tested is tested well.
+
+---
+
+## 4. Edge cases to consider every time
+
+```
+empty · null · absent · zero · negative · very large · very long
+special characters · unicode · leading and trailing whitespace
+duplicate · concurrency · repeated call (idempotence)
+dependency unavailable · timeout · partial response
+authorisation refused · not authenticated · session expired
+time zone · daylight saving · deadline date
+```
+
+---
+
+## 5. Flaky tests
+
+A flaky test is an **engineering problem**, never a fact of life. Its real cost: it
+teaches the team to ignore a CI failure. A single tolerated flaky test degrades the
+value of the whole suite.
+
+```mermaid
+flowchart TD
+ A["Flaky test detected"] --> B["Isolate it: quarantine,
do not delete"]
+ B --> C{"Cause?"}
+ C -->|"Real time"| D1["Inject the clock"]
+ C -->|"Execution order"| D2["Isolate state between tests"]
+ C -->|"Concurrency"| D3["Synchronise on the event,
never on a duration"]
+ C -->|"Network / external"| D4["Deterministic double"]
+ C -->|"Shared state"| D5["Reset for every test"]
+ C -->|"Undetermined"| E["The test proves nothing:
rewrite it or delete it"]
+
+ D1 --> F["Out of quarantine"]
+ D2 --> F
+ D3 --> F
+ D4 --> F
+ D5 --> F
+
+ style E fill:#7c2d12,color:#fff
+ style F fill:#065f46,color:#fff
+```
+
+**Legend** — green: back to a trustworthy suite · red: the test is not worth keeping.
+
+**Never "re-run until it passes".** A disabled test carries an issue and a date to pick
+it back up; without that, it never comes back.
+
+Fixed waits (`sleep`) are the most widespread cause of flakiness: wait for an
+**observable state**, never for a duration.
+
+---
+
+## 6. Doubles
+
+| Double | Do not double |
+|---|---|
+| External services, network, clock, randomness | The business logic of the module under test |
+| Slow or expensive dependencies | What the test is meant to verify |
+| Other modules — through their **contract** | The database, in an integration test |
+
+> **Never double another module's behaviour by guessing.** You double its contract, and
+> the contract test guarantees the contract matches reality. An invented double goes
+> green while production breaks.
+
+---
+
+## 7. Warning signals
+
+| Signal | Reading |
+|---|---|
+| A test breaks at every refactor with no behaviour change | It tests the implementation, not the behaviour |
+| You have to start another module to test | Bad boundary (`.nstack/handbook/02-modules.md` §9) |
+| The test is longer than the code it tests | The code is probably too coupled |
+| Nobody understands what this test tests | Delete it or rewrite it; it protects nothing |
+| The suite takes more than 10 minutes | It will be bypassed — making it fast is a priority task |
diff --git a/.claude/skills/ux/SKILL.md b/.claude/skills/ux/SKILL.md
new file mode 100644
index 0000000..248911a
--- /dev/null
+++ b/.claude/skills/ux/SKILL.md
@@ -0,0 +1,136 @@
+---
+name: ux
+description: 'The project''s UX/UI rules: the primacy of convention and of the design system, the eight states of an interface, error messages, accessibility, perceived performance and mobile behaviour. Load this playbook when you are touching: a surface visible to the user.'
+---
+
+
+
+# Playbook — UX/UI
+
+> **Trigger.** Load this playbook when you are touching: a surface visible to the user.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/ux.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Entry rule: convention wins
+
+This is the ground where the Prior Art Gate (`.nstack/handbook/06-decisions.md`) pays off most.
+
+> For an interface pattern, the value of the convention comes **precisely from the fact
+> that the user already knows it**. An unrequested interface innovation is a learning
+> cost imposed on every user for the satisfaction of a single designer.
+
+Before designing a component or a journey:
+
+1. does the project's design system already cover it? → use it, done.
+2. otherwise, what is the established convention for this problem? → adopt it.
+3. departing from it requires a named, observable user value.
+
+**Never create a component that already exists in the design system.** It is the most
+common form of wheel reinvention, and the most expensive to undo.
+
+---
+
+## The eight states of an interface
+
+A feature is not finished if one of these states has not been handled. It is the number
+one cause of the gap between "it works on my machine" and "it is usable".
+
+```mermaid
+flowchart LR
+ A["1 · Empty
first use"] --> B["2 · Loading"]
+ B --> C["3 · Nominal"]
+ C --> D["4 · Partial
incomplete data"]
+ D --> E["5 · Error
recoverable"]
+ E --> F["6 · Error
blocking"]
+ F --> G["7 · Empty after
a filter or search"]
+ G --> H["8 · Too much data
pagination, truncation"]
+
+ style A fill:#1f2937,color:#fff
+ style E fill:#7c2d12,color:#fff
+ style F fill:#7c2d12,color:#fff
+```
+
+**Legend** — dark grey: the state every user sees first · red: the error states.
+
+States 1, 7 and 8 are the most systematically forgotten. Yet state 1 is the one **every**
+user sees first.
+
+---
+
+## Error messages
+
+| Do | Avoid |
+|---|---|
+| Say what happened, in the user's language | Showing a technical code alone |
+| Say **what to do next** | "An error has occurred" |
+| Preserve what the user had typed | Clearing the form |
+| Distinguish an input error from a system failure | Treating both the same way |
+| Stay discreet about the technical detail | Exposing a trace or an exploitable detail |
+
+An error message with no possible action is a dead end: the user can only start again
+identically.
+
+---
+
+## Accessibility
+
+Not negotiable as soon as there is an interface. Minimum checks:
+
+| Point | Test |
+|---|---|
+| Full keyboard navigation | Go through the whole feature without a mouse |
+| Focus visible at all times | Tab from end to end |
+| Sufficient contrast | Automated check |
+| Images and icons that carry meaning | Text alternative |
+| Forms | Associated labels, errors tied to the field |
+| Information never carried by colour alone | Visual check |
+| Consistent heading structure | Document inspection |
+| Large enough touch targets | Test on a real mobile device |
+| Dynamic region | Change announced to screen readers |
+
+Whatever can be automated is automated in CI. **The rest is tested with the keyboard**,
+in a few minutes — the best effort-to-detection ratio in the field.
+
+---
+
+## Perceived performance
+
+What matters is the **felt** time, not the measured time.
+
+| Situation | Handling |
+|---|---|
+| Action expected to be instant | Immediate visual feedback, before the server even answers |
+| Short wait | A discreet indicator, no full blocking |
+| Long wait | Real progress, and a cancellable action where possible |
+| Content arriving in pieces | Reserve the space to avoid layout shifts |
+| Optimistic action | Plan the rollback explicitly in case of failure |
+
+---
+
+## Responsive and mobile
+
+The development machine is not representative.
+
+- Check at a narrow width, not only in a resized browser.
+- Test touch interactions: no hover as the only trigger.
+- Check the behaviour with the virtual keyboard open.
+- Check over a slow connection.
+
+---
+
+## Closing checklist
+
+- [ ] The 8 states handled, or explicitly out of scope
+- [ ] Convention or design system respected; every deviation justified
+- [ ] Error messages actionable
+- [ ] Full keyboard navigation, focus visible
+- [ ] Contrasts checked
+- [ ] Tested at a real mobile width
+- [ ] Visual feedback on every action
+- [ ] No component reinvented
+- [ ] The test sheet covers the 8 states, or states which are out of scope (`verification.md`)
+- [ ] Whatever could not be verified appears under `NOT VERIFIED` in the summary
diff --git a/.claude/skills/verification/SKILL.md b/.claude/skills/verification/SKILL.md
new file mode 100644
index 0000000..818b384
--- /dev/null
+++ b/.claude/skills/verification/SKILL.md
@@ -0,0 +1,145 @@
+---
+name: verification
+description: 'The project''s rules for verifying a change: the verifier''s posture, running a test sheet against the running change, the evidence expected for each result, and what to report. Load this playbook when you are touching: verifying a change you did not write, filling in a test sheet.'
+---
+
+
+
+# Playbook — Verification
+
+> **Trigger.** Load this playbook when you are touching: verifying a change you did not
+> write, filling in a test sheet.
+>
+> **This project's own rules** on the subject, when it has any: `docs/project/rules/verification.md`
+> — read them with this playbook. They add to it or tighten it.
+
+---
+
+## Your posture
+
+You are the **verifier**. You did not write this change, and you do not fix it. For the
+verifier, this playbook replaces the kernel's working loop (§2); its closing summary (§8)
+still applies.
+
+| You do | You never do |
+|---|---|
+| Start from the need, the acceptance criteria and the test sheet | Read the diff before running the sheet |
+| Run every scenario against the running change | Fix the code, even one line |
+| Bring back evidence for every result | Write "passed" without evidence |
+| Report the gaps against the need or against correctness | Report a preference as a gap |
+
+The session that wrote the change cannot verify it: start another session, with a fresh
+context, or hand the sheet to a human. Sign the sheet with your session's identifier —
+`Verifier: session ` — or, as a person, `Verifier: @`. CI compares it with the
+change's authors and refuses a match; each person named must have written the sheet into the
+description or reviewed or commented on the pull request, under their own account. Writing the
+sheet starts the check again; a review or a comment is read at the next run, which any edit of the
+description starts.
+
+### Your own ground
+
+You verify on someone's machine, beside work that goes on. Leave it as you found it.
+
+- **A copy of your own**: a working tree checked out at the head, and build outputs of your
+ own. Check out the pull request's branch, one tracking it, or the head detached: a record made
+ on a branch of another name is another pull request's (`.nstack/handbook/05-workflow.md` §7). A tree another session edits, or outputs another branch built, give results that are
+ not this change's. Where a sandbox keeps `.git` read-only, a worktree cannot be added: a
+ `git clone --shared ` checked out at the head is that copy, ``
+ and build outputs both under your own cache (`$XDG_CACHE_HOME`, which `nstack agent run --
+ claude` sets — for Cargo, `CARGO_TARGET_DIR` there), never the system's temporary folder, which a quota shares with
+ everyone on the machine. Both are deleted when you leave.
+- **The machine's shared state** — a default device, a setting, a service, data others read —
+ is touched only as the scenario needs, and is put back after each run, also on failure.
+ What another program holds — a user's own running copy of the product, their files — is
+ never touched.
+- **What you start, you stop, by its process number** — never by a name or a pattern, which
+ also matches what is not yours. When you leave, nothing of yours is left running.
+- **The description is fetched again just before you write it**: the author may have edited
+ it since you read it, and your edit must keep theirs.
+
+---
+
+## The procedure
+
+1. **Read the need** — the deliverable, its acceptance criteria, the test sheet in the
+ pull request's description. Nothing else yet.
+2. **Start the change** — the module's `run` verb, or the environment named in
+ `.nstack/tooling-profile.md`. A module with no `run` verb — a library, a contract — has
+ nothing to start: its scenarios run through its tests, and you say so in your report.
+3. **Run each scenario**, in order:
+ - *automated* — the module's `e2e` verb, or its `test` verb when it declares no `e2e`;
+ the evidence is the CI run on the head commit, or its artefact — where checks are attested,
+ the evidence branch below — for a change to a
+ visible surface, read the run's screenshots and logs (`.evidence/e2e/`, its `audit.json`)
+ and cite what they showed: never "rendering not seen" on a scenario passed. An audit
+ `not run` (exit 77) ran no scenario: each one it stood for is *not verified*, or run where
+ it can run;
+ - *explored* — drive the interface yourself, in a browser, an emulator or on a device,
+ with the tools of the tooling profile; capture the screen at the step that proves the
+ result;
+ - *human only* — do not run it; check that its reason is stated and, when the
+ deliverable's acceptance rests on it, that an acceptance issue asks it of a person.
+4. **Record** each result in the sheet — `passed`, `failed — `, or
+ `not verified` — with its evidence and the short hash of the commit you tested; a `|` in a cell,
+ in a code span too, is written `\|`. What you
+ have to add goes on the line **`Verifier's remarks:`** under the table, never in a cell: a
+ scenario that passed by your own probe and not by the test it cites, a wording that claims
+ more than was exercised. A remark is not a result, and the approver reads it. After a
+ fix, an *automated* scenario is run again at the head and its Commit cell takes the head —
+ it is never confirmed; an *explored* one keeps its commit and is confirmed in
+ the `Confirmed` column with the head commit and what moved since — after a `;` when the cell holds an
+ earlier confirmation; at criticality
+ `critical`, every scenario is run again (`.nstack/handbook/05-workflow.md` §7).
+5. **Only then read the diff**, to explain a failure — never to decide a result — and ask one
+ question of its tests: **is the entry point a real user calls exercised the way they call
+ it?** A suite that always passes what the user never passes is green on a path nobody takes.
+6. **Report** the failures first — observed, expected, evidence — then any optional
+ remark, marked as such.
+
+### Mutants
+
+To show that a test pins what it claims, change the code it claims to pin and watch it fail — a
+mutant. A mutant can make the code loop forever, so it is never run unbounded:
+
+- **The language's tool first**, rather than a loop of your own: `cargo-mutants` (Rust; `--file`
+ to aim it, `--timeout` to bound it), `mutmut` (Python), Stryker (JavaScript, TypeScript, C#,
+ Scala), PIT (Java).
+- **By hand**, one mutant per run, each run under a time limit — `timeout 120 `; a timeout counts as killed: the mutant changed what the code does.
+- **The source restored on every exit**, not only at the end — `trap 'git checkout -- '
+ EXIT`, or mutate in a throwaway copy of your own (above).
+- **Report the counts** — killed, survived, timed out — and each survivor with its line: a
+ survivor is a test that does not pin what it claims.
+
+---
+
+## Evidence
+
+| Scenario | Evidence expected |
+|---|---|
+| An interface | A screenshot of the state that proves the result; a video for a sequence |
+| A mobile interface | The screenshot of the emulator or the device, with its width or model |
+| An API, a job, data | The command and its output, or the log lines |
+| Accessibility | The keyboard path followed, and the automated report when there is one |
+
+Test data only: never a real user's data, never a secret on a screenshot (`security.md`).
+Evidence lives where the whole team sees it — a CI artefact, or an image attached to the
+pull request. **Where checks are attested**, no CI run keeps an artefact, and an agent's identity
+cannot attach an image through the forge's API: the verifier commits the screenshots and videos
+that prove a criterion on a branch of its own, `evidence/`, never on the change's
+branch — its head stays the one verified (T4), and the verifier writes no commit of the change
+(T2) — and links each file from the sheet at that branch's commit. Made-up data only, each file
+read before it is pushed: a public repository keeps it for good, and no secret scanner reads an
+image (`security.md`). The `check-added-large-files` hook bounds each file as it is committed;
+the branch is deleted once the cycle is closed.
+
+A user-facing change covers the eight states of an interface (`ux.md`), or says which are
+out of scope. A state missing from the sheet is a gap to report.
+
+---
+
+## When the sheet itself is wrong
+
+A scenario that does not match the need, or a need no scenario covers: report it. An
+expected result changes only with the decider's agreement, visibly in the sheet's history.
diff --git a/.copier-answers.yml b/.copier-answers.yml
index e68b7c3..6c3b899 100644
--- a/.copier-answers.yml
+++ b/.copier-answers.yml
@@ -1,7 +1,17 @@
# The project creation answers and the NapkinStack version (_commit).
-# Managed by Copier: changed by nstack update, never by hand.
-_commit: v0.6.2
+# Lines starting with _ are Copier's: changed by nstack update, never by hand.
+# The project's answers below — checks, approval, hold_days, agent_sockets, the review budget — are the decider's:
+# `nstack config` lists them and lays a change on a branch, for a pull request a human approves;
+# nstack update keeps them (.nstack/handbook/07-governance.md §7).
+_commit: v0.34.11
_src_path: https://github.com/NapkinStack/engineering-os.git
+agent_sockets: false
+approval: human
+checks: forge
+forge: github
github_repo: NapkinStack/flet
+hold_days: 7
owner_team: NapkinStack/maintainers
project_name: flet
+review_budget_files: 15
+review_budget_lines: 400
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..01a2a72
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,3 @@
+# Generated by `nstack skills` from .nstack/playbooks/: committed, folded in review diffs, never edited.
+.claude/skills/** linguist-generated=true
+.agents/skills/** linguist-generated=true
diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS
index 5b78839..3265ccb 100644
--- a/.github/CODEOWNERS
+++ b/.github/CODEOWNERS
@@ -1,21 +1,16 @@
-# Ties every change to an owner (docs/os/07-governance.md §7).
+# Ties every change to an owner (.nstack/handbook/07-governance.md §7).
# Updated automatically by nstack new-module.
# Default owner: every path the rules below do not name. With the code owner review
-# required, a human approval covers every file (docs/os/07-governance.md §7).
+# required, a human approval covers every file (.nstack/handbook/07-governance.md §7).
* @NapkinStack/maintainers
# Foundation: any change to the OS itself goes through an ADR.
/AGENTS.md @NapkinStack/maintainers
-/playbooks/ @NapkinStack/maintainers
-/docs/os/ @NapkinStack/maintainers
/.nstack/ @NapkinStack/maintainers
/.github/ @NapkinStack/maintainers
/.copier-answers.yml @NapkinStack/maintainers
-# Contracts: the most critical boundary in the system, never orphaned.
-/contracts/ @NapkinStack/maintainers
-
# Modules — one line per module, added by the scaffolding.
/modules/screening/ @NapkinStack/maintainers
/modules/copying/ @NapkinStack/maintainers
diff --git a/.github/ISSUE_TEMPLATE/01-feature.yml b/.github/ISSUE_TEMPLATE/01-feature.yml
deleted file mode 100644
index 97040b2..0000000
--- a/.github/ISSUE_TEMPLATE/01-feature.yml
+++ /dev/null
@@ -1,106 +0,0 @@
-name: Feature
-description: A new user capability
-labels: ["feature"]
-body:
- - type: markdown
- attributes:
- value: |
- This issue must be understandable by another human **or an agent** with no
- spoken conversation. Otherwise it is not *Ready*.
-
- - type: input
- id: module
- attributes:
- label: Target module
- description: EXACTLY ONE. If the task touches two, split it (docs/os/02-modules.md §7).
- placeholder: modules/billing
- validations: { required: true }
-
- - type: input
- id: deliverable
- attributes:
- label: Deliverable
- description: >-
- The deliverable of the current cycle this issue delivers (docs/project/cycles/).
- Empty only for work outside the cycle.
- placeholder: D1
-
- - type: textarea
- id: goal
- attributes:
- label: Goal
- description: What the user must be able to do. One sentence.
- validations: { required: true }
-
- - type: textarea
- id: context
- attributes:
- label: Context
- description: Why now. Link to the PDR or the ADR when the decision is taken.
- validations: { required: true }
-
- - type: textarea
- id: out-of-scope
- attributes:
- label: Out of scope
- description: What is explicitly NOT done here. This is the section that prevents drift.
- validations: { required: true }
-
- - type: textarea
- id: acceptance
- attributes:
- label: Acceptance criteria
- description: Testable — they are the task's oracle (docs/os/05-workflow.md §3).
- value: |
- - [ ] Given , when , then
- - [ ] Given , when , then
- validations: { required: true }
-
- - type: checkboxes
- id: cases
- attributes:
- label: Cases to cover
- options:
- - label: Nominal journey
- - label: Edge cases
- - label: Invalid input
- - label: Permissions
- - label: Empty state / first use (when there is UI)
- - label: External dependency error
-
- - type: dropdown
- id: contracts
- attributes:
- label: Contracts
- options:
- - No contract affected
- - Contract consumed (existing)
- - Contract provided changed → a separate issue, expand/contract
- validations: { required: true }
-
- - type: checkboxes
- id: playbooks
- attributes:
- label: Playbooks to load
- options:
- - label: security.md — authn/authz, secrets, personal data, external input
- - label: data-migration.md — schema or existing data
- - label: ux.md — user-facing surface
- - label: tests.md — a test strategy that is not obvious
- - label: operations.md — logs, retries, timeouts, rollback
-
- - type: checkboxes
- id: dor
- attributes:
- label: Definition of Ready
- options:
- - label: Goal understandable with no spoken exchange
- required: true
- - label: A single target module
- required: true
- - label: Scope and out of scope explicit
- required: true
- - label: Testable acceptance criteria
- required: true
- - label: Fits the review budget — otherwise split it now
- required: true
diff --git a/.github/ISSUE_TEMPLATE/01-request.yml b/.github/ISSUE_TEMPLATE/01-request.yml
new file mode 100644
index 0000000..8929452
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/01-request.yml
@@ -0,0 +1,31 @@
+name: Request
+description: Something asked for that no cycle plans yet
+labels: ["request"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ A request is **not work yet**. The next framing makes it a deliverable of a cycle,
+ or refuses it with a reason (.nstack/handbook/06-decisions.md §9). Work a cycle already
+ plans is described there, once — not here.
+
+ - type: textarea
+ id: need
+ attributes:
+ label: Who asks, and what they cannot do today
+ description: One user, one situation. Not a solution.
+ validations: { required: true }
+
+ - type: textarea
+ id: evidence
+ attributes:
+ label: Evidence
+ description: What shows the need is real, with its source. "Nobody asked" is an answer.
+ validations: { required: true }
+
+ - type: textarea
+ id: cost-of-nothing
+ attributes:
+ label: What happens if nothing is done
+ description: And by when. Without it, the request cannot be weighed against the cycle's other work.
+ validations: { required: true }
diff --git a/.github/ISSUE_TEMPLATE/02-bug.yml b/.github/ISSUE_TEMPLATE/02-bug.yml
index 20f092b..89efafb 100644
--- a/.github/ISSUE_TEMPLATE/02-bug.yml
+++ b/.github/ISSUE_TEMPLATE/02-bug.yml
@@ -21,6 +21,15 @@ body:
description: Minimal steps. If it is not reproducible, say so — that is information.
validations: { required: true }
+ - type: input
+ id: brought
+ attributes:
+ label: Pull request that brought it
+ description: >-
+ The number of the merged pull request the defect came in with, or "unknown" —
+ what escaped is measured on it (.nstack/handbook/10-measurement.md).
+ validations: { required: true }
+
- type: input
id: impact
attributes:
@@ -31,7 +40,7 @@ body:
- type: checkboxes
id: guardrail
attributes:
- label: Feedback loop (docs/os/10-measurement.md §4)
+ label: Feedback loop (.nstack/handbook/10-measurement.md §4)
description: Fixing the bug is not enough — improve the system that let it through.
options:
- label: A test reproducing the bug will be added (it must fail BEFORE the fix)
diff --git a/.github/ISSUE_TEMPLATE/03-architecture.yml b/.github/ISSUE_TEMPLATE/03-architecture.yml
index 96c1006..1ff3a44 100644
--- a/.github/ISSUE_TEMPLATE/03-architecture.yml
+++ b/.github/ISSUE_TEMPLATE/03-architecture.yml
@@ -8,7 +8,7 @@ body:
label: Signal observed
description: |
Which coupling signal triggered this issue?
- (docs/os/02-modules.md §9) — recurring cross-module PRs, a cycle detected,
+ (.nstack/handbook/02-modules.md §9) — recurring cross-module PRs, a cycle detected,
modules always deployed together, an agent unable to work through the contract…
validations: { required: true }
@@ -24,7 +24,7 @@ body:
label: Prior art
description: |
How is this problem solved elsewhere? Minimum two references.
- (docs/os/06-decisions.md §2)
+ (.nstack/handbook/06-decisions.md §2)
validations: { required: true }
- type: checkboxes
diff --git a/.github/ISSUE_TEMPLATE/05-debt.yml b/.github/ISSUE_TEMPLATE/04-debt.yml
similarity index 92%
rename from .github/ISSUE_TEMPLATE/05-debt.yml
rename to .github/ISSUE_TEMPLATE/04-debt.yml
index dc129ce..31435a7 100644
--- a/.github/ISSUE_TEMPLATE/05-debt.yml
+++ b/.github/ISSUE_TEMPLATE/04-debt.yml
@@ -31,6 +31,6 @@ body:
- type: checkboxes
id: automatable
attributes:
- label: Automation backlog (docs/os/07-governance.md §9)
+ label: Automation backlog (.nstack/handbook/07-governance.md §9)
options:
- label: This debt comes from a rule living in the prompt that should be automated
diff --git a/.github/ISSUE_TEMPLATE/04-spike.yml b/.github/ISSUE_TEMPLATE/04-spike.yml
deleted file mode 100644
index 4afd89b..0000000
--- a/.github/ISSUE_TEMPLATE/04-spike.yml
+++ /dev/null
@@ -1,26 +0,0 @@
-name: Spike / Investigation
-description: Resolve an uncertainty. The deliverable is knowledge, not code.
-labels: ["spike"]
-body:
- - type: textarea
- id: question
- attributes:
- label: Question to answer
- description: A closed question. If it is open-ended, the spike will never finish.
- validations: { required: true }
-
- - type: input
- id: timebox
- attributes:
- label: Timebox
- placeholder: "2 days"
- validations: { required: true }
-
- - type: textarea
- id: deliverable
- attributes:
- label: Expected deliverable
- description: |
- A documented answer, an ADR, a throwaway prototype.
- The code produced here is NOT destined for production.
- validations: { required: true }
diff --git a/.github/ISSUE_TEMPLATE/05-acceptance.yml b/.github/ISSUE_TEMPLATE/05-acceptance.yml
new file mode 100644
index 0000000..8d38060
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/05-acceptance.yml
@@ -0,0 +1,54 @@
+name: Acceptance
+description: A deliverable tried by a person — what to run, what was seen
+labels: ["acceptance"]
+body:
+ - type: markdown
+ attributes:
+ value: |
+ An acceptance **tracks** a deliverable; it does not describe it. The criteria are in
+ the cycle and are not copied here; the deliverable's state is never read from this issue:
+ `nstack deliver D --held '=#'` records what it answers, and the
+ closure writes the state into the cycle. This issue holds what a file holds badly: who runs what, on what, and
+ what they saw (.nstack/handbook/06-decisions.md §9). Each answer is a comment; a test
+ sheet cites it as its evidence.
+
+ One issue is **one trial**: a person, a system, a set of steps. It is closed when each
+ step has its answer — met or not — by whoever ran it, or by the pull request that
+ records the last one. Closing it says nothing of the deliverable: what was not met is
+ fixed and tried again in another issue, or said in the cycle.
+
+ - type: input
+ id: tracks
+ attributes:
+ label: What it tracks
+ description: The deliverable's identifier and its cycle's file — a pointer, not a copy.
+ placeholder: "D3 — docs/project/cycles/01-….md"
+ validations: { required: true }
+
+ - type: input
+ id: who
+ attributes:
+ label: Who runs it, and on what
+ description: A person, and what no agent has — a device, a real call, a colleague's machine.
+ validations: { required: true }
+
+ - type: textarea
+ id: run
+ attributes:
+ label: What to run
+ description: >-
+ One step per criterion a person must try, as a gesture to make — the command, the
+ action — and what it must show. A step answered is ticked, with the comment that
+ answers it.
+ value: |
+ - [ ] 1. — must show:
+ validations: { required: true }
+
+ - type: textarea
+ id: elsewhere
+ attributes:
+ label: What is already held elsewhere
+ description: >-
+ The criteria a test sheet or a test already holds, each with its pull request. What
+ nobody holds yet is said too.
+ validations: { required: false }
diff --git a/.github/pull_request_template.md b/.github/pull_request_template.md
index 6689431..505d661 100644
--- a/.github/pull_request_template.md
+++ b/.github/pull_request_template.md
@@ -12,7 +12,7 @@ Closes #
- [ ] ⚠️ Cross-module — the `cross-module` label is required, justification below
+expand/contract sequence, not a single PR (`.nstack/handbook/03-contracts.md`).>
## Deliverable
@@ -22,16 +22,18 @@ Deliverable: D
> outside the cycle — an incident, a production defect — carries the `out-of-cycle` label,
> and replaces the line above with `Out of cycle: `. A pull request that changes no
> module beyond its description — manifest, `AGENTS.md`, `README.md`, `docs/` — such as a
-> framework update, is not delivery work: the line does not apply.
+> framework update, is not delivery work: the line does not apply, unless the manifest moves
+> the module's criticality or its user-visible surface.
## What it changes
+says why. A change with a shape — a flow, who reads what, a before and an after — is drawn:
+one Mermaid diagram with its legend, in place of the prose it shows; a change of words is not.>
## Oracle
-> `docs/os/05-workflow.md` §3
+> `.nstack/handbook/05-workflow.md` §3
- [ ] The success criterion was written **before** the implementation
- [ ] It was seen **failing**, for the right reason
@@ -44,7 +46,7 @@ other:
## Review budget
-> `docs/os/05-workflow.md` §4
+> `.nstack/handbook/05-workflow.md` §4
- Lines changed (excluding generated):
- Files touched:
@@ -59,7 +61,8 @@ other:
- [ ] No contract affected
- [ ] Contract consumed — the version is declared in the manifest
- [ ] Contract changed, **additive** — contract tests green, and `nstack compat` proving it
- once the version is consumed or stable
+ once the version is consumed or stable; a promise of its page reversed:
+ — no consumer relies on it, or the change is breaking
- [ ] Contract changed, **breaking** — expand/contract step no. <1|2|3|4>, ADR linked,
removal date set
@@ -68,20 +71,20 @@ other:
## Definition of Done
> Tick what is **applicable** for the module's criticality
-> (`docs/os/05-workflow.md` §7). Never tick a box without having actually run it.
+> (`.nstack/handbook/05-workflow.md` §7). Never tick a box without having actually run it.
- [ ] Oracle green
- [ ] Lint, format, types
- [ ] Unit tests
- [ ] Build
-- [ ] Contract tests *(when there is a contract)*
+- [ ] Contract tests
- [ ] Fitness functions
-- [ ] Integration tests *(per risk)*
+- [ ] Integration tests
- [ ] Security analysis
-- [ ] Accessibility *(when there is UI)*
-- [ ] E2E on critical journeys *(criticality high and above)*
-- [ ] Observability added *(criticality high and above)*
-- [ ] Rollback verified *(criticality critical)*
+- [ ] Accessibility
+- [ ] E2E on critical journeys
+- [ ] Observability added
+- [ ] Rollback verified
- [ ] Affected documentation updated
- [ ] Diff self-reviewed line by line
@@ -89,25 +92,36 @@ other:
## Test sheet
-> Required when the pull request changes a user-facing module, or one of criticality high
-> or critical, beyond its description — manifest, `AGENTS.md`, `README.md`, `docs/`
-> (`docs/os/05-workflow.md` §7). The scenarios come from the acceptance
+> Required when the pull request changes a module the table of `.nstack/handbook/05-workflow.md` §7
+> asks a sheet of — a user-facing one from `standard` up, any one of criticality high or
+> critical — beyond its description: manifest, `AGENTS.md`, `README.md`, `docs/` — or moves its
+> criticality or its user-visible surface. The
+> scenarios come from the acceptance
> criteria and are written before the code; the results are filled in by a verifier who is
-> not the author (`playbooks/verification.md`). Kind: automated · explored · human only —
+> not the author (`.nstack/playbooks/verification.md`). Kind: automated · explored · human only —
> reason. Result: passed · failed — what was observed · not verified.
+>
+> **Confirmed** is for a fix landed after the verification: an *automated* scenario is simply run
+> again at the head and its **Commit** cell takes the head — nothing here; one *explored* by hand
+> keeps its commit and gets the head commit here with what moved since, after a `;` when an earlier confirmation is there — except at criticality `critical`, where every scenario is run again. Leave
+> it empty when nothing moved — a confirmation is not a round.
-Verifier: <@handle, or session and the agent session's identifier>
+Verifier: <@handle, or session and the agent session's identifier> —
-| # | Given · when · then | Kind | Result | Evidence | Commit |
-|---|---|---|---|---|---|
-| S1 | | | | | |
+| # | Given · when · then | Kind | Result | Evidence | Commit | Confirmed |
+|---|---|---|---|---|---|---|
+| S1 | | | | | | — |
+
+> A scenario that waits on a person is asked in an acceptance issue; its Evidence cell links the answer.
+
+Verifier's remarks:
---
## Summary
> An imposed format. The last three sections are the most important and the most often
-> skated over. (`docs/os/05-workflow.md` §8)
+> skated over. (`.nstack/handbook/05-workflow.md` §8)
**DONE**
@@ -129,8 +143,8 @@ Verifier: <@handle, or session and the agent session's identifier>
## Signals to report
- [ ] I had to look at another module's implementation → **a signal of a bad boundary**
- (`docs/os/02-modules.md` §9)
+ (`.nstack/handbook/02-modules.md` §9)
- [ ] A kernel or playbook rule got in my way for no good reason
- [ ] A quality gate blocked without improving quality
- [ ] A rule applied by hand would be worth automating
- → the automation backlog (`docs/os/07-governance.md` §9)
+ → the automation backlog (`.nstack/handbook/07-governance.md` §9)
diff --git a/.github/workflows/commits-on-main.yml b/.github/workflows/commits-on-main.yml
index a74e7a6..7b95ba4 100644
--- a/.github/workflows/commits-on-main.yml
+++ b/.github/workflows/commits-on-main.yml
@@ -1,6 +1,6 @@
name: Commits on main
-# What reached this branch outside a pull request, recorded (W1, PDR-0006).
+# What reached this branch outside a pull request, recorded (rule W1, .nstack/handbook/RULES.md).
#
# This workflow RECORDS; it never refuses. What refuses a merge is the ruleset, and on a
# repository whose plan cannot enforce one, nothing refuses at all — which is exactly when
@@ -20,18 +20,19 @@ on:
permissions:
contents: read
pull-requests: read
+ actions: read # the record's own last success, where the next run starts reading (a run that never started)
jobs:
landed:
name: Commits on main
- runs-on: ubuntu-latest
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: NapkinStack, the project version
run: bash .nstack/install-engine.sh
diff --git a/.github/workflows/governance.yml b/.github/workflows/governance.yml
index f2a79ac..3aad4c8 100644
--- a/.github/workflows/governance.yml
+++ b/.github/workflows/governance.yml
@@ -2,9 +2,10 @@ name: Governance
# Architecture fitness functions, pull request scope, hooks and secrets.
# These checks are NOT BYPASSABLE: that is what separates a rule from a pious wish
-# (docs/os/07-governance.md).
+# (.nstack/handbook/07-governance.md).
#
-# To do once: Settings → Rules → Rulesets → require these checks on the main branch.
+# To do once, by the repository's owner: nstack settings --apply requires these checks on the
+# default branch (nstack doctor reads them back).
# Without that, CI informs but guarantees nothing.
#
# Security, verified by zizmor: a read-only token, actions pinned by SHA and kept up to
@@ -26,13 +27,13 @@ permissions:
jobs:
architecture:
name: Fitness functions
- runs-on: ubuntu-latest
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: NapkinStack, the project version
run: bash .nstack/install-engine.sh
@@ -43,7 +44,7 @@ jobs:
scope:
name: PR scope and review budget
if: github.event_name == 'pull_request'
- runs-on: ubuntu-latest
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
steps:
# fetch-depth: 0 fetches every branch: no authenticated git fetch to do.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
@@ -51,7 +52,7 @@ jobs:
fetch-depth: 0
persist-credentials: false
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: NapkinStack, the project version
run: bash .nstack/install-engine.sh
@@ -64,14 +65,14 @@ jobs:
hooks:
name: Hooks and secrets
- runs-on: ubuntu-latest
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9 # v6.1.0
with:
@@ -88,6 +89,19 @@ jobs:
SKIP: gitleaks
run: pre-commit run --all-files --show-diff-on-failure
- # Rule S1: no secret in the repository. Output redacted, the logs are public.
+ # No secret in the repository (rule SEC1 of .nstack/playbooks/security.md). Output redacted, the logs are public.
- name: Secrets in the whole git history
run: pre-commit run gitleaks-history --hook-stage manual --all-files
+
+ # A commit message and a pull request's description are pages anyone reads: the hook
+ # that refuses a link into a private assistant session reads them here, where it
+ # cannot be bypassed. Values from the context come through env (zizmor).
+ - name: No private session link in a message
+ env:
+ BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
+ DESCRIPTION: ${{ github.event.pull_request.body }}
+ run: |
+ said="$RUNNER_TEMP/said.txt"
+ printf '%s\n' "$DESCRIPTION" > "$said"
+ if git cat-file -e "$BASE^{commit}" 2>/dev/null; then git log --format=%B "$BASE..HEAD" >> "$said"; fi
+ pre-commit run no-session-link --hook-stage commit-msg --commit-msg-filename "$said"
diff --git a/.github/workflows/module-checks.yml b/.github/workflows/module-checks.yml
index e8d1e30..4cadb5b 100644
--- a/.github/workflows/module-checks.yml
+++ b/.github/workflows/module-checks.yml
@@ -1,17 +1,18 @@
name: Modules
# Runs the standard verbs on the changed modules only: nstack reads their commands
-# from the module's MANIFEST.yaml, assuming no stack (P1). A module is a folder holding a
+# from the module's MANIFEST.yaml, assuming no stack. A module is a folder holding a
# MANIFEST.yaml, contracts/ included: nstack lists them, the workflow defines nothing.
# The level of validation is proportionate to the criticality declared in the MANIFEST
-# (docs/os/07-governance.md §6).
+# (.nstack/handbook/07-governance.md §6).
#
-# `Module checks` is the required check: a matrix job carries each module's name, which no
-# ruleset can require in advance, so this job fails whenever one of them failed.
+# `Module checks` is the required check, and the only job: every changed module runs in it, one
+# after another, through .nstack/check-modules.sh. Each job is billed at least a minute: one job
+# costs what the modules' verbs take, where a job per module, a listing and a summary cost three.
#
# A change to a contract version also runs the checks of the module that provides it and of
# every module that declares it in consumes: the contract tests of both sides, which is what
-# docs/os/03-contracts.md section 5 promises.
+# .nstack/handbook/03-contracts.md section 5 promises.
#
# Module names come from the paths the pull request changed: they are never inserted
# into a script, only read from an environment variable.
@@ -25,124 +26,38 @@ permissions:
contents: read
jobs:
- discover:
- name: Changed modules
- runs-on: ubuntu-latest
- outputs:
- modules: ${{ steps.list.outputs.modules }}
- any: ${{ steps.list.outputs.any }}
- base: ${{ steps.list.outputs.base }}
+ checks:
+ name: Module checks
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
steps:
+ # A job starts clean: what an earlier job left in the checkout — a build that failed
+ # half-way on a self-hosted runner — is removed before this one runs.
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
+ clean: true
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: NapkinStack, the project version
run: bash .nstack/install-engine.sh
- - id: list
+ # bootstrap, check, test, compat even after a failure, e2e, and clean on a self-hosted
+ # runner — module by module (.nstack/handbook/05-workflow.md §7, 09-platform.md §2).
+ - name: Every changed module
env:
BASE: ${{ github.event.pull_request.base.sha || github.event.before }}
- run: |
- if ! git rev-parse --verify --quiet "$BASE^{commit}" >/dev/null; then
- if [ "$GITHUB_EVENT_NAME" = pull_request ]; then
- echo "::error::Base $BASE of the pull request not found: its modules cannot be listed." \
- "Action: run the jobs again; the checkout fetches the whole history."
- exit 1
- fi
- # The first push of a branch has no previous commit: every file is new.
- BASE=$(git rev-list --max-parents=0 HEAD | tail -1)
- fi
- MODS=$(nstack modules --root . --changed-since "$BASE" --with-contract-sides --json)
- echo "modules=$MODS" >> "$GITHUB_OUTPUT"
- echo "base=$BASE" >> "$GITHUB_OUTPUT"
- if [ "$MODS" = '[]' ]; then echo "any=false" >> "$GITHUB_OUTPUT";
- else echo "any=true" >> "$GITHUB_OUTPUT"; fi
- echo "Modules with a file changed: $MODS"
-
- validate:
- name: ${{ matrix.module.name }}
- needs: discover
- if: needs.discover.outputs.any == 'true'
- runs-on: ubuntu-latest
- strategy:
- fail-fast: false
- matrix:
- module: ${{ fromJson(needs.discover.outputs.modules) }}
- env:
- MODULE: ${{ matrix.module.name }}
- FOLDER: ${{ matrix.module.folder }}
- BASE: ${{ needs.discover.outputs.base }}
- steps:
- - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- with:
- fetch-depth: 0
- persist-credentials: false
-
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
-
- - name: NapkinStack, the project version
- run: bash .nstack/install-engine.sh
+ run: bash .nstack/check-modules.sh
- - name: Declared criticality
- id: crit
- run: |
- LEVEL=$(yq '.module.criticality // "standard"' "$FOLDER/MANIFEST.yaml")
- echo "level=$LEVEL" >> "$GITHUB_OUTPUT"
- echo "Criticality: $LEVEL"
-
- - name: bootstrap
- run: nstack bootstrap "$MODULE"
-
- # All levels — docs/os/05-workflow.md §7
- - name: check
- run: nstack check "$MODULE"
-
- - name: test
- run: nstack test "$MODULE"
-
- # A contract version someone relies on changes only with the merged proof (V1,
- # docs/os/03-contracts.md §4). The step runs even when an earlier one failed: a pull
- # request that breaks a frozen version AND a test would otherwise meet V1 a round trip
- # later, once the tests are green (D46).
- - name: compat
- if: ${{ !cancelled() }}
- run: nstack compat "$MODULE" --base "$BASE"
-
- # Levels high and critical — not wired up yet (D9)
- - name: Integration tests
- if: steps.crit.outputs.level == 'high' || steps.crit.outputs.level == 'critical'
- run: |
- echo "Not wired up: integration tests (D9)"
-
- # Optional verb: the module's end-to-end scenarios, when declared (docs/os/09-platform.md §2).
- - name: e2e
- run: nstack e2e "$MODULE"
-
- # The evidence the test sheet links to (docs/os/05-workflow.md §7), kept even on failure.
+ # The evidence the test sheet links to (.nstack/handbook/05-workflow.md §7), kept even on
+ # failure: one archive, a folder per module.
- name: Evidence of the scenarios
if: always()
- uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
+ uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
- name: evidence-${{ matrix.module.name }}
- path: ${{ matrix.module.folder }}/.evidence/
+ name: evidence
+ path: "**/.evidence/"
include-hidden-files: true
if-no-files-found: ignore
retention-days: 30
-
- checks:
- name: Module checks
- needs: [discover, validate]
- if: always()
- runs-on: ubuntu-latest
- steps:
- - name: Every changed module passed
- env:
- DISCOVERED: ${{ needs.discover.result }}
- VALIDATED: ${{ needs.validate.result }}
- run: |
- echo "Changed modules: $DISCOVERED. Their checks: $VALIDATED."
- [ "$DISCOVERED" = success ] && { [ "$VALIDATED" = success ] || [ "$VALIDATED" = skipped ]; }
diff --git a/.github/workflows/plan-on-the-forge.yml b/.github/workflows/plan-on-the-forge.yml
new file mode 100644
index 0000000..c05a647
--- /dev/null
+++ b/.github/workflows/plan-on-the-forge.yml
@@ -0,0 +1,55 @@
+name: Plan on the forge
+
+# The cycles and their deliverables, shown on GitHub as milestones and issues (`nstack board`).
+#
+# The cycle files are the plan; this workflow only SHOWS them, one way. An issue or a milestone
+# edited by hand is put back at the next run, and the run says so: the plan is edited in
+# docs/project/cycles/, in a pull request. Nothing here ever refuses anything — a forge that
+# refuses a call is said in the run's summary, and the run succeeds.
+#
+# When: a merge to the default branch (the plan changed), once a day (a hold changed — a claim
+# pushes a branch holding no file, so no workflow of it can start), and by hand — Run workflow
+# here, never `nstack board` beside it: this workflow's runs wait for one another, a command run
+# elsewhere does not, and two at once each make the same issue. Whatever triggered it,
+# the run reads the default branch's tip: a re-run never shows an older plan.
+#
+# Rights: writing issues and milestones, reading pull requests and the code — asked by this job
+# alone; the project's other automation stays read-only (rule G10). The holds are fetched with
+# the job's token for that one command; the checkout keeps no credential.
+
+on:
+ push:
+ branches: [main]
+ schedule:
+ - cron: "17 5 * * *"
+ workflow_dispatch:
+
+permissions: {}
+
+concurrency:
+ group: plan-on-the-forge
+ cancel-in-progress: false
+
+jobs:
+ board:
+ name: Plan on the forge
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
+ permissions:
+ contents: read
+ issues: write
+ pull-requests: read
+ steps:
+ - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
+ with:
+ ref: ${{ github.event.repository.default_branch }}
+ persist-credentials: false
+
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
+
+ - name: NapkinStack, the project version
+ run: bash .nstack/install-engine.sh
+
+ - name: The cycles, shown as milestones and issues
+ env:
+ GH_TOKEN: ${{ github.token }}
+ run: nstack board
diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml
index 4605cee..7fafee6 100644
--- a/.github/workflows/pull-request.yml
+++ b/.github/workflows/pull-request.yml
@@ -1,8 +1,12 @@
name: Pull request
# The rules read from the pull request's description: the test sheet
-# (docs/os/05-workflow.md §7) and the cycle (docs/project/README.md). Editing the
-# description or a label re-evaluates them on the same head commit.
+# (.nstack/handbook/05-workflow.md §7) and the cycle (.nstack/handbook/project.md). Editing the
+# description or a label re-evaluates them on the same head commit. A review or a comment is a
+# person's hand on the pull request when they are its named verifier (T2), read at the next run:
+# never a trigger, since a review's failed run stays beside the later ones and blocks the merge,
+# and an attested record, pushed as notes, is no event that could replace it (D218, #394): its
+# event is its own status, `nstack / local checks`, when a ruleset requires it (D221, #399).
#
# The description is untrusted input: it reaches nstack through env:, never a script.
@@ -11,19 +15,26 @@ on:
types: [opened, edited, synchronize, reopened, labeled, unlabeled]
permissions:
- contents: read
+ contents: read # the head, and the attested record in the remote's notes (A1, A2)
+ pull-requests: read # whose hand is on the pull request: a person named verifier (T2); approvals (R1, R2)
+
+# Each event's run reads the description and the head as they were at that event: a later event
+# of the same pull request cancels the earlier run, so the verdict shown is the last one's.
+concurrency:
+ group: pull-request-${{ github.event.pull_request.number }}
+ cancel-in-progress: true
jobs:
description:
name: Test sheet and cycle
- runs-on: ubuntu-latest
+ runs-on: ${{ vars.NSTACK_RUNS_ON || 'ubuntu-latest' }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
fetch-depth: 0
persist-credentials: false
- - uses: astral-sh/setup-uv@bec219d24cd3e171d82865faccec33120bb574f4 # v10.1.0
+ - uses: astral-sh/setup-uv@68559e99cc807c1eb7e9238fd43a15bba460eec2 # v10.3.3
- name: NapkinStack, the project version
run: bash .nstack/install-engine.sh
@@ -34,5 +45,7 @@ jobs:
PR_LABELS: ${{ join(github.event.pull_request.labels.*.name, ',') }}
PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
PR_AUTHOR: ${{ github.event.pull_request.user.login }}
- BASE_REF: ${{ github.base_ref }}
+ PR_NUMBER: ${{ github.event.pull_request.number }}
+ GH_TOKEN: ${{ github.token }}
+ BASE_REF: ${{ github.event.pull_request.base.ref }}
run: nstack pr-check --root . --base "origin/$BASE_REF"
diff --git a/.gitignore b/.gitignore
index d10e752..731ad47 100644
--- a/.gitignore
+++ b/.gitignore
@@ -14,10 +14,10 @@ coverage/
!.env.example
.DS_Store
-# Skills generated from playbooks/ — the source of truth is playbooks/
-.claude/skills/
+# The skills nstack generates from .nstack/playbooks/ are committed (.claude/skills/, .agents/skills/):
+# an agent starting from a fresh clone needs them. Their source is .nstack/playbooks/.
-# Evidence of the end-to-end scenarios: a CI artefact, never committed
+# Evidence of the end-to-end scenarios: a CI artefact, or an evidence branch — never committed to a change
.evidence/
# Editors and IDEs
@@ -30,6 +30,9 @@ coverage/
# Local agent settings: machine-specific paths and permissions
.claude/settings.local.json
+# A clone's resume note (.nstack/playbooks/pause-and-resume.md): one per clone, never shared
+.nstack/local/
+
# Agent session and machine state: written by the tool as it runs, never by the project.
# `.claude/settings.json` and `.claude/hooks/` are deliberately absent from this list —
# project-level settings and hooks are shared with the team on purpose. What follows is
@@ -58,4 +61,12 @@ Desktop.ini
id_rsa*
id_ed25519*
.envrc
-secrets.*
+# Secret files by their data formats, never secrets.*: where git ignores case, as on macOS,
+# that also left out source code such as Secrets.swift.
+secrets.env
+secrets.json
+secrets.yaml
+secrets.yml
+secrets.toml
+secrets.ini
+secrets.txt
diff --git a/.nstack/check-modules.sh b/.nstack/check-modules.sh
new file mode 100755
index 0000000..302a23d
--- /dev/null
+++ b/.nstack/check-modules.sh
@@ -0,0 +1,55 @@
+#!/usr/bin/env bash
+# The standard verbs of every changed module, one module after another, in the one CI job the
+# project's ruleset requires: `Module checks` (.nstack/handbook/09-platform.md §2).
+#
+# nstack lists the modules with a file changed since BASE, and both sides of a contract version
+# the change touches (.nstack/handbook/03-contracts.md §5). For each one: bootstrap, check, test;
+# then compat, even after a failure, so that a broken frozen version is named in the same round
+# (.nstack/handbook/03-contracts.md §4); then e2e, on a module still green; then clean, on a
+# self-hosted runner only, even after a failure — a hosted machine is thrown away after the job.
+# A module that fails does not stop the next one; the job fails at the end, naming them.
+#
+# The module names come from the paths the change touched: they reach the commands as variables,
+# never as script text. The criticality is printed, never branched on: what a value requires is
+# judged by the rules that read the matrix of .nstack/handbook/05-workflow.md §7.
+set -uo pipefail
+
+BASE=${BASE:?the commit the change is compared with}
+if ! git rev-parse --verify --quiet "$BASE^{commit}" >/dev/null; then
+ if [ "${GITHUB_EVENT_NAME:-}" = pull_request ]; then
+ echo "::error::Base $BASE of the pull request not found: its modules cannot be listed." \
+ "Action: run the jobs again; the checkout fetches the whole history."
+ exit 1
+ fi
+ BASE=$(git rev-list --max-parents=0 HEAD | tail -1) # a branch's first push: every file is new
+fi
+
+LIST=$(nstack modules --root . --changed-since "$BASE" --with-contract-sides) || exit 1
+if [ -z "$LIST" ]; then
+ echo "No module with a file changed: nothing to check."
+ exit 0
+fi
+
+FAILED=()
+while IFS=$'\t' read -r MODULE FOLDER <&3; do
+ echo "::group::$MODULE"
+ VALUE=$(sed -n "s/^ criticality: *['\"]\{0,1\}\([a-z]*\).*/\1/p" "$FOLDER/MANIFEST.yaml" | head -1)
+ echo "Criticality: ${VALUE:-undeclared}"
+ case "$VALUE" in
+ prototype|standard|high|critical) ;;
+ *) echo "Not a value the engine knows: judged as critical until M3 is satisfied." ;;
+ esac
+ GREEN=1
+ { nstack bootstrap "$MODULE" && nstack check "$MODULE" && nstack test "$MODULE"; } || GREEN=0
+ nstack compat "$MODULE" --base "$BASE" || GREEN=0
+ if [ "$GREEN" = 1 ]; then nstack e2e "$MODULE" || GREEN=0; fi
+ if [ "${RUNNER_ENVIRONMENT:-}" = self-hosted ]; then nstack clean "$MODULE" || GREEN=0; fi
+ echo "::endgroup::"
+ [ "$GREEN" = 1 ] || FAILED+=("$MODULE")
+done 3<<<"$LIST"
+
+if [ "${#FAILED[@]}" -gt 0 ]; then
+ echo "Module checks failed: ${FAILED[*]}. Each one's log group above names the verb and its output."
+ exit 1
+fi
+echo "Every changed module passed."
diff --git a/.nstack/fitness-before-push.sh b/.nstack/fitness-before-push.sh
new file mode 100755
index 0000000..004cd55
--- /dev/null
+++ b/.nstack/fitness-before-push.sh
@@ -0,0 +1,130 @@
+#!/bin/sh
+# Before a push, the fitness functions CI runs on every pull request: the pre-push hook of
+# .pre-commit-config.yaml. Judged by an engine at the project's version or ahead of it, never
+# behind: an older engine refuses what the project's version defines, and can pass what it
+# refuses. An engine ahead is where an update starts. A project pinned to an unpublished commit
+# (vX.Y.Z-N-g) is ahead of vX.Y.Z: an engine behind that is refused; one at it or ahead
+# judges, and every run of nstack says what it is. A version this cannot read — no answers
+# file, a pre-release — leaves the judging to the engine here, as before, and to CI.
+#
+# Plain sh, with sed and awk: the workstation's engine may predate this file.
+# What nstack records beside the code — a hold's event (claim, unclaim, deliver) on
+# refs/heads/nstack/hold/…, an attested record in refs/notes/nstack/… — moves no file of the
+# project: a red default branch never stops it being recorded (#427). Every other hook still
+# runs on it, and CI judges every pull request.
+# In an agent's session (nstack agent run), nothing is pushed under another identity than the
+# agent's own (#456): a commit git made up from the machine would publish its user and host name.
+# Read: every commit of the local branches and tags, and of the ref pushed, that the remote does not
+# hold yet — pre-commit names only the first ref of a push of several. What a fetch brought — the
+# remote-tracking branches, the attested records fetched beside them, and what nstack claim fetched
+# under refs/nstack-remote/ (the default branch, holds, work branches) — is the remote's already (#484).
+# A merge of the forge's can still reach here through no such ref: a merge of main made in another
+# clone and fetched into FETCH_HEAD, origin/main stale. Before refusing, the hook fetches the default
+# branch of the remote it pushes to into refs/nstack-remote/base, as claim does, and counts again:
+# a clean push fetches nothing; no remote-tracking branch of the person's moves, nor FETCH_HEAD.
+if [ -n "${NSTACK_AGENT:-}" ]; then
+ MINE=$(git config --global user.email)
+ NAME=$(git config --global user.name)
+ if [ -z "$MINE" ] || [ -z "$NAME" ]; then
+ echo "FAIL [nstack] agent ${NSTACK_AGENT} declares no identity in its own git configuration: nothing is pushed."
+ echo " Action: nstack agent run ${NSTACK_AGENT} -- writes it; then amend the commits' author."
+ exit 1
+ fi
+ FROM=""
+ case "${PRE_COMMIT_FROM_REF:-}" in ""|*[!0]*) FROM=${PRE_COMMIT_FROM_REF:-} ;; esac
+ foreign() {
+ git log --format='%ae%x09%ce%x09%an%x09%cn' --branches --tags ${PRE_COMMIT_TO_REF:+"$PRE_COMMIT_TO_REF"} \
+ --not --remotes --glob='refs/nstack-remote/*' --glob='refs/notes/nstack-remote/*' ${FROM:+"$FROM"} 2>/dev/null |
+ awk -F '\t' -v me="$MINE" -v name="$NAME" '$1 != me || $2 != me || $3 != name || $4 != name' | wc -l | tr -d ' '
+ }
+ COUNT=$(foreign)
+ FETCHED=""
+ if [ "${COUNT:-0}" -gt 0 ] && GIT_TERMINAL_PROMPT=0 GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-ssh} -o BatchMode=yes" \
+ git fetch --quiet --no-tags --no-write-fetch-head "${PRE_COMMIT_REMOTE_NAME:-origin}" \
+ "+HEAD:refs/nstack-remote/base" /dev/null 2>&1; then
+ FETCHED=yes
+ COUNT=$(foreign)
+ fi
+ if [ "${COUNT:-0}" -gt 0 ]; then
+ echo "FAIL [nstack] ${COUNT} commit(s) the remote does not hold yet are not agent ${NSTACK_AGENT}'s identity"
+ echo " ($NAME <$MINE>) as author or committer: pushed, they would publish another — this machine's"
+ echo " user and host, or a person's name."
+ echo " Action: the agent's own commits under a made-up identity: git rebase --exec 'git commit --amend"
+ echo " --no-edit --reset-author' . Another's work brought here keeps its author: it is"
+ echo " pushed from that person's own session, never re-signed. Commits the remote already holds"
+ if [ -n "$FETCHED" ]; then
+ echo " (a merge made on the forge) are never re-signed either: this hook fetched the remote's"
+ echo " default branch already; a merge on another branch of the forge: git fetch, then push again."
+ else
+ echo " (a merge made on the forge) are never re-signed either: git fetch, then push again."
+ fi
+ echo " Why: .nstack/handbook/INSTALL.md, *The agent commits as the App*."
+ exit 1
+ fi
+fi
+case "${PRE_COMMIT_REMOTE_BRANCH:-}" in
+ refs/heads/nstack/hold/*|refs/notes/nstack/*) echo "nstack's own record: no file of the project to judge."; exit 0 ;;
+esac
+# A commit naming an Agent-Session that git does not read as a trailer — above a blank line, apart
+# from Co-Authored-By — names no session, and pr-check says so only after the push. The commit-msg
+# hook refuses it at the commit, but git never runs that hook on a rebase or a cherry-pick (#521):
+# the ref pushed is read here, for anyone — pre-commit names the first of several; CI's T2 reads the
+# rest. What the remote holds already is not the push's (a forge's squash keeps each message above its
+# co-authors); fetched first, as above, before refusing. A ref with no ancestor on the remote comes
+# without TO_REF: its local branch is read.
+TIP=${PRE_COMMIT_TO_REF:-${PRE_COMMIT_LOCAL_BRANCH:-HEAD}}
+START=""
+case "${PRE_COMMIT_FROM_REF:-}" in ""|*[!0]*) START=${PRE_COMMIT_FROM_REF:-} ;; esac
+unread() {
+ git log --format=%H -i -E --grep='^agent-session[[:blank:]]*:' "$TIP" \
+ --not --remotes --glob='refs/nstack-remote/*' ${START:+"$START"} 2>/dev/null |
+ while read -r commit; do
+ [ -n "$(git log -1 --format='%(trailers:key=Agent-Session,valueonly)' "$commit")" ] ||
+ git log -1 --format=' %h %s' "$commit"
+ done
+}
+UNREAD=$(unread)
+REFETCHED=""
+if [ -n "$UNREAD" ] && GIT_TERMINAL_PROMPT=0 GIT_SSH_COMMAND="${GIT_SSH_COMMAND:-ssh} -o BatchMode=yes" \
+ git fetch --quiet --no-tags --no-write-fetch-head "${PRE_COMMIT_REMOTE_NAME:-origin}" \
+ "+HEAD:refs/nstack-remote/base" /dev/null 2>&1; then
+ REFETCHED=yes
+ UNREAD=$(unread)
+fi
+if [ -n "$UNREAD" ]; then
+ echo "FAIL [nstack] $(printf '%s\n' "$UNREAD" | wc -l | tr -d ' ') commit(s) name an Agent-Session git does not read as a trailer:"
+ printf '%s\n' "$UNREAD"
+ echo " Its line is not in the message's last paragraph: git reads no session, and pr-check refuses it."
+ echo " Action: put Agent-Session with Co-Authored-By and any other trailer, one block, no blank line"
+ echo " between them — git rebase -i , \`reword\` on each; on the last commit alone,"
+ echo " git commit --amend. Why here: a rebase or a cherry-pick never runs the commit-msg hook that"
+ echo " refuses it at the commit."
+ if [ -n "$REFETCHED" ]; then
+ echo " A commit the remote holds — a merge made on the forge — is never rewritten: this hook fetched"
+ echo " the remote's default branch already; one of another branch of the forge: git fetch, then push again."
+ else
+ echo " A commit the remote holds — a merge made on the forge — is never rewritten: git fetch, then push again."
+ fi
+ exit 1
+fi
+
+command -v nstack >/dev/null 2>&1 || { echo "nstack is not installed: CI judges"; exit 0; }
+
+RECORDED=$([ -f .copier-answers.yml ] && tr -d '\r' < .copier-answers.yml |
+ sed -n "s/^_commit: *['\"]\{0,1\}\(v[0-9]*\.[0-9]*\.[0-9]*\(-[0-9]*-g[0-9a-f]*\)\{0,1\}\)['\"]\{0,1\} *$/\1/p")
+WANTED=${RECORDED%%-*}
+WANTED=${WANTED#v}
+HERE=$(nstack --version | sed -n 's/^nstack \([0-9]*\.[0-9]*\.[0-9]*\).*/\1/p')
+if [ -n "$WANTED" ] && [ -n "$HERE" ] && awk -v here="$HERE" -v wanted="$WANTED" 'BEGIN {
+ split(here, h, "."); split(wanted, w, ".")
+ for (i = 1; i <= 3; i++) { if (h[i] + 0 < w[i] + 0) exit 0; if (h[i] + 0 > w[i] + 0) exit 1 }
+ exit 1 }'; then
+ echo "FAIL [nstack] This workstation runs nstack $HERE; the project is on $RECORDED. Its rules are not"
+ echo " the project's: it would refuse what $RECORDED defines, and could pass what it refuses."
+ echo " Action: bash .nstack/install-engine.sh # the version the project records, then push again"
+ exit 1
+fi
+
+for check in manifests boundaries plan hygiene; do
+ nstack "$check" --root . || exit 1
+done
diff --git a/docs/adr/_TEMPLATE.md b/.nstack/forms/adr.md
similarity index 80%
rename from docs/adr/_TEMPLATE.md
rename to .nstack/forms/adr.md
index a401ad8..e8bdadb 100644
--- a/docs/adr/_TEMPLATE.md
+++ b/.nstack/forms/adr.md
@@ -1,5 +1,7 @@
# ADR-XXXX —
+> The framework's words: `.nstack/handbook/glossary.md`.
+
- **Status**: Proposed | Accepted | Superseded by ADR-YYYY | Abandoned
- **Date**: YYYY-MM-DD
- **Decision makers**:
@@ -28,7 +30,7 @@ budget, deadline, compliance. Distinguish real constraints from preferences.>
## Prior art
> **Mandatory section.** Minimum two named references. A missing section or a missing
-> reference → refused in review, pending an automated check. (`docs/os/06-decisions.md` §2)
+> reference → refused in review, pending an automated check. (`.nstack/handbook/06-decisions.md` §2)
**Dominant convention of the field:**
@@ -64,6 +66,8 @@ are not acceptable justifications.>
## Decision
+
+
@@ -85,6 +89,12 @@ description: the argument that settled it.>
What we do if it is not:
+
+
---
## Consequences
@@ -96,7 +106,7 @@ What we do if it is not:
**Impacts on other modules or contracts:**
**Rule to automate:**
+none is possible, explain why. `.nstack/handbook/07-governance.md` §2>
---
diff --git a/docs/project/_CHARTER_TEMPLATE.md b/.nstack/forms/charter.md
similarity index 68%
rename from docs/project/_CHARTER_TEMPLATE.md
rename to .nstack/forms/charter.md
index 7a9188d..b932192 100644
--- a/docs/project/_CHARTER_TEMPLATE.md
+++ b/.nstack/forms/charter.md
@@ -7,11 +7,15 @@ success_criteria: # when the goal is reached: measurable, dated or r
# Charter —
-> Written once, at the first framing (`playbooks/framing.md`), copied to `charter.md`;
+> The framework's words: `.nstack/handbook/glossary.md`.
+
+> Written once, at the first framing (`.nstack/playbooks/framing.md`), copied to `docs/project/charter.md`;
> changed only through a PDR. Every agent session reads it.
## Users and their problem
+
+
## Success criteria
@@ -40,4 +44,6 @@ success_criteria: # when the goal is reached: measurable, dated or r
**Blocking:**
-**Not blocking:**
+Once it is accepted, this charter holds no open question: one that arrives goes to the
+current cycle's questions, and an answer that changes the charter is a PDR, which the change
+cites (`.nstack/playbooks/framing.md`, *Decisions*).
diff --git a/.nstack/forms/cycle.md b/.nstack/forms/cycle.md
new file mode 100644
index 0000000..2b3d8a0
--- /dev/null
+++ b/.nstack/forms/cycle.md
@@ -0,0 +1,76 @@
+---
+goal: ""
+status: proposed # proposed | accepted | closed | stopped — the decider accepts
+appetite_weeks: 2 # the time the decider WANTS to spend, not an estimate — appetite_days: N instead, never both, for a cycle shorter than a week
+start: 2026-01-05 # YYYY-MM-DD
+end: 2026-01-19 # start + appetite: the first day the cycle is over — the circuit breaker
+# accepted_on: YYYY-MM-DD # accepted while another cycle runs: stays proposed, the running cycle's closure starts it; kept once accepted
+deliverables:
+ - id: D1
+ title: ""
+ module: "" # null for a spike run outside the code, or whose product is a record, not shipped code
+ state: proposed # proposed | ready (testable criteria) | in-progress (older, still read) | accepted (at the closure: nstack deliver --write-states) | deferred | dropped — held and delivered are read from records, never written
+ acceptance: # given · when · then, required from ready on: the test sheet starts here
+ - "Given , when , then "
+# outcome: completed # closed: completed | shipped — stopped: reframed | stopped
+# ended_on: YYYY-MM-DD
+# success: # at the closure, the charter's success criteria this cycle moved, if any
+# - criterion: 1 # its number in the charter's list, from 1
+# state: observing # met | observing — the latest closure's record is its state
+# since: YYYY-MM-DD # observing: the day observation started
+---
+
+# Cycle NN —
+
+> The framework's words: `.nstack/handbook/glossary.md`.
+
+> Copied to `docs/project/cycles/NN-.md` at framing (`.nstack/playbooks/framing.md`). One accepted cycle at a
+> time; no automatic extension.
+
+## Goal
+
+
+
+## Deliverables
+
+One section per deliverable, under its identifier: a session reads the front matter and its
+own deliverable's section, never the others. What binds goes here — order, dependencies, its
+decisions and their links; what was tried, what it cost and what was refuted goes to the
+project's log issue (`.nstack/handbook/06-decisions.md` §9).
+
+### D1
+
+
+
+## What needs a person
+
+
+
+| Deliverable | Who | The literal gesture |
+|---|---|---|
+| | | |
+
+## Out of scope
+
+
+
+## Later
+
+
+
+## Open questions
+
+**Blocking:**
+
+**Not blocking:**
+
+## Closure
+
+
+
+**Documents brought current:**
diff --git a/docs/project/_DISCOVERY_TEMPLATE.md b/.nstack/forms/discovery.md
similarity index 95%
rename from docs/project/_DISCOVERY_TEMPLATE.md
rename to .nstack/forms/discovery.md
index 4734528..e14df13 100644
--- a/docs/project/_DISCOVERY_TEMPLATE.md
+++ b/.nstack/forms/discovery.md
@@ -9,7 +9,9 @@ round: 1
# Discovery
-> Started by the engine's `discover` command, run by your agent (`playbooks/discovery.md`).
+> The framework's words: `.nstack/handbook/glossary.md`.
+
+> Started by the engine's `discover` command, run by your agent (`.nstack/playbooks/discovery.md`).
> One document, a decision at the end of each round.
## 1. Intake
diff --git a/docs/pdr/_TEMPLATE.md b/.nstack/forms/pdr.md
similarity index 80%
rename from docs/pdr/_TEMPLATE.md
rename to .nstack/forms/pdr.md
index 348e061..0c277c9 100644
--- a/docs/pdr/_TEMPLATE.md
+++ b/.nstack/forms/pdr.md
@@ -1,5 +1,7 @@
# PDR-XXXX —
+> The framework's words: `.nstack/handbook/glossary.md`.
+
- **Status**: Proposed | Accepted | Superseded by PDR-YYYY | Abandoned
- **Date**: YYYY-MM-DD
- **Decision makers**:
@@ -32,7 +34,7 @@ prevents gradual drift.>
## Prior art
> **Mandatory section.** Minimum two named references.
-> (`docs/os/06-decisions.md` §2)
+> (`.nstack/handbook/06-decisions.md` §2)
**How is this problem solved elsewhere?**
@@ -67,6 +69,8 @@ knowing it.>
## Expected behaviour
+
+
**Nominal journey:**
**Edge cases and degraded states:**
@@ -76,7 +80,7 @@ knowing it.>
**Permissions:**
**Acceptance criteria** *(testable — this is the task's oracle,
-`docs/os/05-workflow.md` §3)*:
+`.nstack/handbook/05-workflow.md` §3)*:
- [ ] Given , when , then
- [ ] …
@@ -88,7 +92,7 @@ knowing it.>
> Fill this in only when the feature is genuinely complex: many actors, a state machine,
> a permission matrix. Otherwise, delete this section.
>
-> It replaces the old FDR format (`docs/os/06-decisions.md` §4).
+> It replaces the old FDR format (`.nstack/handbook/06-decisions.md` §4).
**Actors:**
**States and transitions:**
@@ -109,6 +113,12 @@ How it is observed:
If the criterion is not met:
+
+
---
## Removal condition
diff --git a/.nstack/forms/rules.md b/.nstack/forms/rules.md
new file mode 100644
index 0000000..0d95740
--- /dev/null
+++ b/.nstack/forms/rules.md
@@ -0,0 +1,12 @@
+# Rules of this project —
+
+> Copied to `docs/project/rules/.md` the day the project has a rule of its own on that
+> subject: `security.md` is read with the security playbook, `always.md` with the charter, for
+> every task. These rules add to what every project shares, or tighten it; they never repeat
+> it. A rule that concerns one module only belongs in that module's `AGENTS.md`.
+
+
+
+| # | Rule | Why | Checked by |
+|---|---|---|---|
+| 1 | | | |
diff --git a/docs/os/00-overview.md b/.nstack/handbook/00-overview.md
similarity index 61%
rename from docs/os/00-overview.md
rename to .nstack/handbook/00-overview.md
index 9295529..6a45cc0 100644
--- a/docs/os/00-overview.md
+++ b/.nstack/handbook/00-overview.md
@@ -28,7 +28,7 @@ flowchart TB
K1["5 laws"]
K2["Working loop"]
K3["Stopping rules"]
- K4["Uncertainty
protocol"]
+ K4["Stop · Hold · Close"]
end
subgraph L1["PLAYBOOKS — loaded by trigger"]
@@ -139,47 +139,65 @@ delivery: it lengthens the queue and degrades the quality of the review itself.
### What the framework cannot know: three levels of rules
-| Level | Holds | Maintained by |
-|---|---|---|
-| **Framework** — identical in every project, received through updates | Postures, the five laws, the working loop, stopping rules, framing, the test discipline, templates, checks | The framework |
-| **Project** | Users, problem, constraints, success criteria, cycles, the project's decisions, its tools | The foundation team and the decider: `docs/project/`, `docs/adr/`, `docs/pdr/`, `docs/tooling-profile.md` |
-| **Module** | Its capability, commands, contracts, scenarios | Its owner: `MANIFEST.yaml`, local `AGENTS.md` |
+```mermaid
+flowchart LR
+ F["FRAMEWORK
what every project shares
No secret in the repository"]:::fw
+ P["PROJECT
what this project adds
Health data never leaves the EU"]:::pr
+ M["MODULE
what this module adds
The card number is never logged"]:::mo
+ F -->|"completed by"| P -->|"completed by"| M
+
+ classDef fw fill:#374151,color:#fff
+ classDef pr fill:#1e3a8a,color:#fff
+ classDef mo fill:#065f46,color:#fff
+```
+
+**Legend** — grey: received through updates, the same everywhere · blue: written by the
+project, read by every session that works in it · green: written by a module's owner, read
+only by who works in that module. In italics, one rule of each level on one subject, security.
+
+| Level | Holds | Written in | Maintained by |
+|---|---|---|---|
+| **Framework** — identical in every project | Postures, the five laws, the working loop, stopping rules, framing, the test discipline, templates, checks | The kernel and `.nstack/playbooks/` | The framework, through updates |
+| **Project** | Users, problem, constraints, success criteria, cycles, its decisions, its tools — and **its own rules** on any subject a playbook covers | `docs/project/`, `docs/adr/`, `docs/pdr/`, `.nstack/tooling-profile.md` — its rules in `docs/project/rules/` | The foundation team and the decider |
+| **Module** | Its capability, commands, contracts, scenarios, its invariants and its traps | `MANIFEST.yaml`, the module's `AGENTS.md` | Its owner |
+
+**A nearer level adds or tightens; it never repeats.** A project's rule on security is read
+*with* the security playbook, not instead of it: `docs/project/rules/security.md`, loaded by
+the same trigger. `docs/project/rules/always.md` holds the few that apply to every task. The
+folder is empty at creation, and each file is born the day a constraint, a decision or an
+incident gives it a first line — as early as a discovery's intake, where a project settles
+the language it writes in.
**The framework never names a stack, a tool or a business domain.** A project rule is
written in a project document, never in the kernel or a playbook: the framework's files
keep merging cleanly at every update.
+### Method and seat: whose file it is
+
+Every file the framework writes into a project is one of two things, never both.
+
+| | Method | Seat |
+|---|---|---|
+| **Whose** | The framework's | The project's |
+| **At creation** | Written whole | Written as a form: headings, and the place of a diagram |
+| **At an update** | Merged | Never touched again — recreated only when missing; `SECURITY.md` rewritten when the forge changes, the project's text merged in |
+| **Which** | Everything else: the kernel, the playbooks, this handbook, the templates, the checks | `README.md`, `SECURITY.md`, `modules/README.md`, `docs/adr/README.md`, `docs/pdr/README.md` |
+
+A file holding the framework's words *and* waiting for the project's belongs to nobody: the
+project does not delete what looks official, and an update conflicts on what the project
+wrote. So a seat carries no manual, and the manual sits in no seat. What each one holds,
+when it becomes writable and what keeps it current: `06-decisions.md` §10.
+
---
## 6. Glossary
-These terms have a precise meaning in the OS. Using them differently creates ambiguity.
-
-| Term | Definition |
-|---|---|
-| **Module** | An autonomous unit of context and of parallelism: a developer or an agent must be able to understand it, change it, test it and validate it **without understanding the rest of the system**. It can be a package, an application, a service or a repository. |
-| **Playbook** | A module of *instructions* for an agent, loaded on demand (`playbooks/`). Called a "playbook" rather than a "module" to avoid any confusion with the line above. |
-| **Skeleton** | The project's shared files — kernel, playbooks, this handbook, CI, hooks, templates — generated by the engine; the project owns them and adapts them. |
-| **Engine** | The versioned tool that generates the skeleton, updates it and runs the checks; named in `docs/tooling-profile.md`. |
-| **Contract** | A versioned, tested interface between two modules: API, event, schema, message. The **only** channel of inter-module communication allowed. |
-| **Manifest** | A declarative file at the root of every module: identity, owner, criticality, status, contracts provided and consumed, standard commands. The machine-readable source of truth. |
-| **Oracle** | A task's *executable* success criterion, written and seen failing **before** generation: a test, a contract test, or a fitness function. |
-| **Fitness function** | An automated test that fails when the architecture drifts (forbidden dependency, cycle, coupling, performance budget). Governance by rule rather than by inspection. |
-| **Review budget** | An explicit ceiling per pull request (lines, files, modules touched) that forces the split **before** generation. |
-| **Prior Art Gate** | The mandatory procedure before a structuring decision: identify the convention of the field, adopt it by default, deviate only against an observable user value. |
-| **Expand / Contract** | The sequence of pull requests that lets a contract evolve between teams without temporal synchronisation. |
-| **ADR / PDR** | Architecture / Product Decision Record. A durable trail of a structuring decision. |
-| **Appetite** | The calendar time the decider chooses to spend on a cycle — not an estimate. It sets the cycle's end date. |
-| **Charter** | The project's founding document: users, problem, constraints, success criteria, out of scope (`docs/project/charter.md`). |
-| **Circuit breaker** | A cycle's end date: past it, delivery work stops and the decider chooses — ship, re-frame or stop. No automatic extension. |
-| **Cycle** | A bounded unit of work: one goal, a finite list of deliverables, an appetite, an end. |
-| **Deliverable** | An outcome a user can observe, with acceptance criteria, in one module. |
-| **Discovery** | An idea tested before any charter: sourced evidence, a value hypothesis, a challenge by another session, then go, clarify or kill (`docs/project/discovery.md`). |
-| **Posture** | What a participant does, and never does: framer, challenger, author, verifier, approver, decider, owner (`05-workflow.md` §10). |
-| **Test sheet** | The scenarios of a change, written before the code and run by a verifier who is not the author, each with its evidence (`05-workflow.md` §7). |
+The framework's words — who, the work, modules and contracts, rules, records — each in one plain
+sentence, with where you meet it and an example: [`glossary.md`](glossary.md). A rule's code is
+explained in [`RULES.md`](RULES.md).
> **Note.** The **FDR** (Functional Design Record) format does not exist in this OS. It
-> overlapped the PDR and an issue's acceptance criteria without adding distinct value.
+> overlapped the PDR and a deliverable's acceptance criteria without adding distinct value.
> For genuinely complex cases, it becomes an **optional section of the PDR**.
> Justification: `06-decisions.md` § "Why only two formats".
diff --git a/docs/os/01-principles.md b/.nstack/handbook/01-principles.md
similarity index 100%
rename from docs/os/01-principles.md
rename to .nstack/handbook/01-principles.md
diff --git a/docs/os/02-modules.md b/.nstack/handbook/02-modules.md
similarity index 92%
rename from docs/os/02-modules.md
rename to .nstack/handbook/02-modules.md
index 9bf2a63..4d993d1 100644
--- a/docs/os/02-modules.md
+++ b/.nstack/handbook/02-modules.md
@@ -29,7 +29,7 @@ started, tested, validated and shipped.
flowchart TB
subgraph P["PLATFORM — uniform, imposed, versioned"]
direction LR
- P1["Standard verbs
bootstrap · check · test
run · migrate · release"]
+ P1["Standard verbs
one list: 09-platform.md §2"]
P2["File envelope
MANIFEST · AGENTS.md
README · docs/ · tests/"]
P3["Mandatory checks
identical everywhere"]
P4["Issue / PR templates
DoR · DoD"]
@@ -141,11 +141,15 @@ modules//
├── README.md ← for humans: what it is for, how to start
├── docs/
│ ├── adr/ ← local technical decisions
-│ └── runbook.md ← when the module is operated in production
+│ └── runbook.md ← criticality high or critical (05-workflow.md §7)
├── src/
└── tests/
```
+M9 refuses a module without `AGENTS.md`, `README.md` or, unless it is a prototype, `tests/`;
+M8 asks for the runbook at criticality high or critical. The rest is where things go when
+the module has them.
+
The contracts a module provides live in the project's `contracts/` module, one folder per
contract and version (`03-contracts.md` §2), and its manifest points at them
(`provides[].path`).
@@ -165,7 +169,7 @@ This is the piece that makes multi-team work operational. A single declarative f
readable by a human, by an agent **and by CI**.
The manifest `nstack new-module` writes is the reference for the full format;
-`contracts/MANIFEST.yaml` is the one every project already holds. It declares:
+`contracts/MANIFEST.yaml`, written by the first contract, is another. It declares:
- identity and responsibility in one sentence;
- owner (a team, not an individual);
@@ -189,7 +193,7 @@ flowchart LR
MF --> U2["FITNESS FUNCTION
declared graph vs real graph
extracted from the code
→ any gap is a violation"]
- MF --> U3["COORDINATION
a producer/consumer matrix
is generated → you always
know who breaks whom"]
+ MF --> U3["COORDINATION
nstack modules names both sides
of a contract → you always
know who breaks whom"]
U2 --> CI["CI: blocking check"]
U3 --> CI
@@ -269,8 +273,8 @@ violation becomes an architecture signal.
visible, traced and counted.
A module is touched when its behaviour changes: editing only its description — manifest,
-`AGENTS.md`, `README.md`, `docs/` — touches none, and `contracts/` is a module like the
-others.
+`AGENTS.md`, `README.md`, `docs/` — touches none, unless the manifest moves its criticality or
+its user-visible surface, and `contracts/` is a module like the others.
| Exception | Handling |
|---|---|
@@ -325,6 +329,10 @@ forbidden paths.
- business logic shared between distinct domains;
- a shared database without a justifying ADR.
+**Allowed, declared:** another module's release artefacts — what its `release` wrote in its
+folder of `dist/` — read by the module that assembles what ships, which names it in
+`assembles` (`09-platform.md` §2). Its artefacts, never its code.
+
**Allowed but worth watching:** shared technical primitives (logging, errors, utilities
with no business logic). As soon as a business rule enters a shared package, two modules
become inseparable. They live outside the module folders: a module never imports another
diff --git a/docs/os/03-contracts.md b/.nstack/handbook/03-contracts.md
similarity index 74%
rename from docs/os/03-contracts.md
rename to .nstack/handbook/03-contracts.md
index 4166ec7..40f8c9a 100644
--- a/docs/os/03-contracts.md
+++ b/.nstack/handbook/03-contracts.md
@@ -21,6 +21,12 @@ cannot be orphaned.
Like any module it therefore has an owner, a manifest, its own tests, its own rules of
change, and a high criticality by default.
+**It does not exist before the first contract.** A project with one module, or with modules
+that do not talk to each other yet, has no boundary to write down. The command that creates
+a contract creates the module the first time — manifest, owner, runbook — and a page for the
+contract's first version; the module stays green on pages alone, and owes its `check` and
+`test` commands the day a contract gains a schema or a test.
+
**Properties required of a contract:**
| Property | Verification |
@@ -80,6 +86,15 @@ from seconds to milliseconds, a nullable field that becomes always filled. Techn
compatible, functionally breaking. These are the most expensive breakages because no diff
tool detects them — only contract tests do.
+**A comparator guards the consumers, not the shape.** It judges a version's schema: an
+addition is compatible, and a wrong field inside that addition is too. What a version says
+exactly — the event it emits, its fields' values — is held by the version's own tests. Nor
+does it read the contract's page: a promise written there — "never says how loud" — can be
+reversed by an addition it calls compatible. The diagram's first question decides it: a
+consumer that relied on the promise makes the change breaking; when none does, it stays
+additive and the page is corrected. A person catches it in review: the pull request's
+Contracts section names the promise it changes.
+
---
## 4. Expand / Contract
@@ -122,10 +137,31 @@ sequenceDiagram
| **3 — Migration** | Each consumer | Switches to v2, at its own pace | Manifest updated: version consumed |
| **4 — Contract** | Producer | Removal of v1 | v1 consumers = 0, checked (B6) |
+**The order holds for a version's name too.** B1 reads a version named in a consumer's files
+as that version consumed, and B6 refuses a consumer declared before its producer: a consumer
+that names v2 before step 1 is merged — even in a test that shows v2 refused — fails B1 in
+every pull request, and cannot declare it. Write the name after step 1.
+
+**Declaring a version is not writing it.** Where a consumer must read a format before its
+producer writes it — a file, a message, anything already stored — two modules still have an
+order, in separate pull requests, within the four steps above:
+
+- first the producer declares v2 in its `provides`, the page beside it and v1's removal date
+ set, and goes on writing v1;
+- then the consumer declares v2 beside v1, and reads both;
+- last the producer writes v2.
+
+Each step passes B1 and B6 on its own: no consumer names a version before it is declared, and
+nothing asks both manifests in one pull request.
+
+**A test that a consumer refuses a later version** names one that will never be declared —
+`minutes/vnext` — never the next number. B1 reads any declared version a module names, refused or not: a
+test naming `minutes/v3` fails the producer's declaration of v3, and costs the consumer a pull request of its own.
+
### The three guardrails
**① The deprecation date is a check.** From PR 1 onwards, v1 carries a removal date. A
-check fails once the date has passed and consumers remain. Without it, you accumulate
+check fails once the date has passed while the version is still provided (M6). Without it, you accumulate
versions nobody dares remove.
**② The contraction is mandatory.** Step 4 is the most often forgotten, and it is
@@ -185,8 +221,9 @@ without a meeting.
## 6. Discovery and traceability
-The producer/consumer matrix is **generated** from the manifests, never kept by hand. It
-answers three questions no team should have to ask in a meeting:
+Who provides and who consumes a contract is read from the manifests, never kept by hand:
+`nstack modules --with-contract-sides` names both sides of a changed version, and B6 refuses a
+version consumed and provided by nobody. Together they answer three questions no team should have to ask in a meeting:
- Who consumes my contract, and in which version?
- What does my module consume, and which versions are deprecated?
diff --git a/docs/os/04-ai-context.md b/.nstack/handbook/04-ai-context.md
similarity index 76%
rename from docs/os/04-ai-context.md
rename to .nstack/handbook/04-ai-context.md
index ac765ad..8417b3a 100644
--- a/docs/os/04-ai-context.md
+++ b/.nstack/handbook/04-ai-context.md
@@ -25,21 +25,10 @@ organise deployment.
flowchart TD
T["Incoming task"] --> S{"Scope
identifiable?"}
S -->|No| S2["Clarify, or state
an explicit assumption"] --> S
- S -->|Yes| U["Load: the kernel
+ the module's AGENTS.md and MANIFEST"]
-
- U --> N{"Playbooks
triggered?"}
- N -->|"authn · secrets · personal data"| N1["+ security.md"]
- N -->|"schema · migration"| N2["+ data-migration.md"]
- N -->|"user-facing surface"| N3["+ ux.md"]
- N -->|"test strategy · flaky"| N4["+ tests.md"]
- N -->|"logs · retries · rollback"| N5["+ operations.md"]
- N -->|None| V
-
- N1 --> V["LOCAL inventory:
code, tests, contracts, decisions"]
- N2 --> V
- N3 --> V
- N4 --> V
- N5 --> V
+ S -->|Yes| U["Load in the kernel's §4 order: charter, your cycle section,
project rules, the module's MANIFEST and AGENTS.md"]
+
+ U --> N["+ the playbooks the task triggers:
the kernel's table, §4 — the only list"]
+ N --> V["LOCAL inventory:
code, tests, contracts, decisions"]
V --> W{"Does the change cross
a boundary?"}
W -->|No| X["Context frozen
→ oracle, then implementation"]
@@ -69,13 +58,16 @@ during implementation is the symptom of a failed framing, not of a useful discov
```
1. kernel AGENTS.md always ~250 lines
-2. the target module's MANIFEST always short
-3. the module's local AGENTS.md always ~50-100 lines
-4. triggered playbook(s) conditional 1 to 2 at most
-5. relevant local code and tests targeted not the whole module
-6. contracts consumed targeted the contract, not the implementation
-7. ADR/PDR tied to the area changed when they exist
-8. another module NEVER without an explicit crossing
+2. the charter; of the current cycle, always docs/project/ — the cycle's front matter
+ its front matter and your section and your deliverable's section, not the rest
+3. the project's own rules always always.md, then .md with playbook
+4. the target module's MANIFEST always short
+5. the module's local AGENTS.md always ~50-100 lines
+6. triggered playbook(s) conditional 1 to 2 at most
+7. relevant local code and tests targeted not the whole module
+8. contracts consumed targeted the contract, not the implementation
+9. ADR/PDR tied to the area changed when they exist
+10. another module NEVER without an explicit crossing
```
Before exploring, an agent must be able to answer five questions. If one has no answer,
@@ -87,6 +79,17 @@ the problem is the framing, not the context:
- Which **decisions** (ADR/PDR) constrain this choice?
- What is this task's **oracle**?
+**What a command prints is context too.** Run a command in its quiet form when it has one,
+and read a long output through what decides — the failures, the summary line. A failure is
+read in full: nothing filters out the lines of the error being fixed. The tool that filters
+is the workstation's, or one the project names in its rules (`docs/project/rules/`); the
+framework requires none.
+
+**One session, one task.** A session keeps what its earlier tasks needed. When the task
+changes — another deliverable, another module — it writes down what the next one needs,
+where things stand and what is left, and a fresh session starts from that. A wide search runs
+in a separate agent, and only its conclusion comes back (§5).
+
---
## 4. Crossing a boundary
diff --git a/.nstack/handbook/05-workflow.md b/.nstack/handbook/05-workflow.md
new file mode 100644
index 0000000..4213654
--- /dev/null
+++ b/.nstack/handbook/05-workflow.md
@@ -0,0 +1,476 @@
+# 05 — Workflow
+
+## 1. The reversal
+
+The classic workflow is: *understand → code → test → review*.
+
+With an agent, that workflow collapses for a simple reason: the "code" step no longer
+costs anything, so it saturates the steps after it. The project produces, faster, what
+nobody has time to verify.
+
+The OS reverses two things:
+
+1. **The oracle before the generation.** The success criterion is executable and red
+ before the first line of code.
+2. **The review budget at the entrance.** The size of the batch is constrained *before*
+ generating, not observed afterwards.
+
+---
+
+## 2. The loop
+
+```mermaid
+flowchart TD
+ A["Task"] --> B{"Trivial?"}
+ B -->|Yes| B1["Do it directly
+ local validations"] --> M
+
+ B -->|No| C["FRAME: intent, scope,
out of scope, risks"]
+ C --> C2["SCOPE: identify THE module,
load the bounded context"]
+ C2 --> C3["INVENTORY: what exists already,
here and in established tools"]
+ C3 --> G{"Batch ≤ review
budget?"}
+ G -->|No| G1["Split it
and start again at framing"] --> C
+ G -->|Yes| D["ORACLE: write the executable
success criterion — no wait:
the plan goes in the pull request"]
+ D --> E{"Oracle
executable?"}
+ E -->|No| E1["Do not generate.
Make the criterion verifiable
or send the framing back"] --> D
+ E -->|Yes| F["Oracle RED — commit"]
+
+ F --> H["IMPLEMENT the
minimal change"]
+ H --> I["VALIDATE: actually
run the checks"]
+ I --> J{"Green?"}
+ J -->|No| J1{"3rd consecutive
failure?"}
+ J1 -->|No| H
+ J1 -->|Yes| J2["STOP — report:
assumption or framing is wrong"]
+ J -->|Yes| K["SELF-REVIEW the diff:
scope, side effects, regressions"]
+
+ K --> L["DOCUMENT the
sources of truth affected"]
+ L --> S["SYNC: bring the branch current
before its pull request"]
+ S --> M["SUMMARISE: done / verified /
assumed / not verified / risks"]
+ M --> V["VERIFY: a verifier who is not the author
runs the test sheet — when §7 requires one"]
+ V --> N["Human review + CI"]
+ N --> Z["CLOSE: once merged and each criterion held,
nstack deliver; the branch is gone —
forge, workstation, worktree"]
+
+ style D fill:#1f2937,color:#fff
+ style F fill:#1f2937,color:#fff
+ style J2 fill:#7c2d12,color:#fff
+ style G1 fill:#7c2d12,color:#fff
+ style E1 fill:#7c2d12,color:#fff
+```
+
+**Legend** — dark grey: the oracle, written and seen red before any code · red: stop and
+go back · the verification comes from someone other than the author.
+
+---
+
+## 3. The oracle
+
+> The oracle is a task's **executable** success criterion, written and seen failing
+> before the generation.
+
+Depending on the task it can be: a unit or integration test, a contract test, a fitness
+function, a migration check, a performance budget, an accessibility test.
+
+### Why watch it fail first
+
+A test that has never been red proves nothing: it may pass because it tests nothing. That
+is a particularly frequent failure mode with generated code, where test and
+implementation are born together and agree on a shared mistake.
+
+### When the oracle is impossible
+
+This is not a marginal case, and it is not an excuse to skip the step. It is a diagnosis:
+
+| Cause | What to do |
+|---|---|
+| The acceptance criterion is subjective | Restate it as an observable behaviour |
+| The task is exploratory | Requalify it as a *spike*: the deliverable is knowledge, not code. Its criteria name what is recorded and the threshold read against it, and **a refuted result is a delivered one**. A spike that measures a step through an imitation of what that step sends — a request, a file, a prompt — first shows the imitation sends the same, byte for byte, as the step does |
+| It waits on someone outside the project | It is a dependency with a date, not a deliverable (`.nstack/playbooks/framing.md`) |
+| The area is untestable | Make it testable first — that is a task in its own right |
+| The need is vague | Back to framing; it was not *Ready* |
+
+In every case: **do not generate while waiting**.
+
+---
+
+## 4. The review budget
+
+This is the most useful quality gate in the OS, because it applies **before** the
+generation instead of observing the damage afterwards.
+
+> The project's real throughput is its verification throughput, not its generation
+> throughput.
+
+The budget is an explicit ceiling, set for the project: its answers `review_budget_lines` and
+`review_budget_files`, 400 lines and 15 files by default, read alike by CI and by `nstack attest`,
+as the base branch holds them: a pull request never sets the budget it is measured by. The decider
+changes them — `nstack config review_budget_lines 600` lays the change on a branch, for a pull
+request a human approves; the pull requests after its merge are measured by it. `MAX_LINES` and
+`MAX_FILES` in the environment override them for one run; the scope check says which source it took. The default follows SmartBear's study of 2,500
+reviews at Cisco (Cohen, *Best Kept Secrets of Peer Code Review*, 2006): past 200 to 400 lines in one
+review, the rate at which a reviewer finds defects drops. A larger budget is the
+decider's to choose, knowing that. Adjusting it per module, by criticality, is not automated: it
+is in the automation backlog. It covers:
+
+| Dimension | Indicative ceiling |
+|---|---|
+| Lines changed (excluding generated and lock files) | ~400 |
+| Files touched | ~15 |
+| Modules touched | **1** |
+| Contracts changed | 1, and a dedicated PR |
+
+These values are starting points to calibrate, not truths. The principle matters more
+than the number: **the batch must be reviewable in one session of attention**.
+
+`nstack pr-scope` leaves out lock files and generated names (`*.generated.*`, `generated/`, the
+skills), and every path the project's `.gitattributes` marks `linguist-generated` (any value but
+`false`), which GitHub also folds in its diffs. A tool's output that no name gives away is declared there, as the licence notices a
+dependency tool writes; the line that declares it is in the diff a reviewer reads.
+
+**Going over.** The check reports, it does not block automatically (except for modules
+touched, where it does block). A justified overrun — code generation, a mechanical
+migration, a mass rename — goes through an explicit label. What matters is that the
+overrun is **visible and counted**: the rate of over-budget pull requests is a health
+indicator (`10-measurement.md`).
+
+Never produce a huge pull request simply because the agent can generate a lot of code
+quickly.
+
+**Bringing a branch current before its pull request.** Fetch the default branch and merge it
+into yours as the last thing before opening the pull request — and again when the forge
+shows a conflict while it waits. Whoever wrote the change settles its conflict in minutes;
+whoever approves it finds it too late and has to guess. What is numbered in sequence — a
+decision record, a row in a register — takes its number at that moment, not when the work
+started: two branches that each took "the next one" on the same morning meet on the same
+line. It narrows the window and does not close it: a pull request merged while yours waits
+can still conflict with it, and the branch is brought current again by its author.
+
+**Splitting a change into pull requests that sit on one another.** Each is opened on the
+branch of the one before, and each carries its own sheet when the module asks for one. Three
+things the forge and the sheet do then, to know before the first merge:
+
+- merging the first **and deleting its branch** closes the next one, which was opened on it:
+ merge without deleting, point the next at the default branch, then delete;
+- the next one's head moves when the default branch is merged into it, and a sheet is tied to
+ the commit tested. When that merge brings no file the branch did not already carry, the two
+ commits hold the same tree and the sheet stands; when it brings one, the automated scenarios
+ are run again at the new head — unless it changed nothing their modules read (§7);
+- a **squash** merge writes the first one's work as a new commit, and the next branch still
+ carries the old ones: it conflicts with what it already holds. Note the merged branch's last
+ commit before the branch goes, move the next one onto the default branch, `git rebase --onto
+ `, and push it with `--force-with-lease`: a forced push dismisses an
+ approval it already had — where the plan has no ruleset to dismiss it, `pr-check` says it
+ (R1) (`07-governance.md` §7).
+
+**Up to date before merging** (G22). Two pull requests each green on its own base can turn the
+default branch red together — one starts reading what the other starts providing —, so the
+ruleset merges a branch only once it carries the default branch: what the checks judged is what
+lands. Three habits keep that from costing the team:
+
+- **update at the last moment**: only the pull request about to merge — reviewed, green — takes
+ the default branch in; the others wait their turn untouched. One update per merge, not one per
+ open pull request each time another merges. Where stale approvals are dismissed (G13), the
+ approval comes after that update, not before it;
+- **update by merging the default branch in, never by a rebase**: a rebase rewrites what was
+ approved; a merge adds one commit that brings the default branch, which the approver reads as
+ that, and `pr-check`'s R1 counts as covered when it carries nothing of its own. Where stale
+ approvals are dismissed (G13), GitHub asks the approval again after an update — measured: a
+ merge of the default branch whose tree equalled the approved head's still dismissed it —; the
+ approver then reads only what the default branch brought. Where an agent approves, the update is
+ the last push, and another identity than its pusher's approves it (G21). The squash keeps the
+ default branch's history one commit per pull request;
+- **one merge at a time**, then the next pull request's turn: it takes the default branch in, its
+ checks run again — where they are attested, `nstack attest` on the updated head, whose status
+ the ruleset waits for, and which keeps a module's checks while nothing they read moved (§7) —
+ and it merges.
+
+**Once merged, a branch is gone.** A merged branch is history, not a place to work: left
+there, it is one more name to read past, and one day somebody builds on it. The forge
+deletes it at the merge when it is set to (`G16`, `07-governance.md` §7) — a guardrail worth
+turning on, and not the whole of it. Whoever merges looks: a merge made from a tool, or from
+a worktree, may report the merge and leave the branch; a setting nobody could read may be
+off. And the forge knows nothing of a workstation: the local branch and the worktree it was
+written in go too, and `git fetch --prune` drops the names of branches that no longer exist.
+After a squash the local branch is not an ancestor of the default one, and git refuses to
+delete it as unmerged: it is deleted once its pull request is seen merged, not before. A
+branch whose pull request was closed without a merge, or that never had one, is not
+cleaned up in passing: its author says whether anything on it is still wanted.
+
+---
+
+## 5. The 3-failure circuit breaker
+
+An agent looping on a fix is almost always treating a framing problem as a code problem.
+Without an explicit stopping point it digs — and it digs fast.
+
+```mermaid
+flowchart TD
+ A["Checks red"] --> B["Attempt 1:
fix the apparent cause"]
+ B --> C{"Green?"}
+ C -->|Yes| OK["Carry on"]
+ C -->|No| D["Attempt 2:
question the diagnosis"]
+ D --> E{"Green?"}
+ E -->|Yes| OK
+ E -->|No| F["Attempt 3:
question the assumption"]
+ F --> G{"Green?"}
+ G -->|Yes| OK
+ G -->|No| H["STOP"]
+
+ H --> H1["Revert the speculative
fixes that piled up"]
+ H1 --> H2["Report: what was tried,
what is ruled out, which
candidate assumptions remain"]
+
+ style H fill:#7c2d12,color:#fff
+ style OK fill:#065f46,color:#fff
+```
+
+**Legend** — green: the loop exits normally · red: the stopping point, and what it
+requires.
+
+The key point is `H1`: **revert the speculative fixes**. Three failed attempts leave
+behind code added "to see" that no longer has a justification. Leaving it in place is the
+quietest way to accumulate debt.
+
+---
+
+## 6. Definition of Ready
+
+Do not start a significant task without:
+
+- [ ] a **deliverable of the current cycle**, ready (`docs/project/`), and held by you —
+ `nstack claim D` — in a framed project; an unframed one has no cycle, and the seven
+ lines below are its whole definition of ready
+- [ ] a goal understandable without a spoken conversation
+- [ ] scope **and out of scope**
+- [ ] the target module identified
+- [ ] **testable** acceptance criteria
+- [ ] known dependencies and contracts
+- [ ] important constraints identified
+- [ ] an acceptable level of risk
+
+If a piece of information is missing without being blocking: move ahead with an
+**explicitly stated assumption**, which will surface in the closing summary. If it is
+genuinely blocking: ask for clarification, once, precisely.
+
+Out of scope is often neglected although it is the most useful part: it is what prevents
+gradual drift and opportunistic refactoring.
+
+---
+
+## 7. Definition of Done
+
+A task is finished when the **applicable** validations have actually passed. Which ones apply
+depends on the module's declared `criticality`. **This table is the only place that says
+which** — nothing else in the framework holds a second version of it, and a check that
+refuses a change reads it here.
+
+Each row says who judges it:
+
+- **machine** — a check in CI fails when it is missing. You cannot forget it, and you cannot
+ talk your way past it.
+- **owed** — no check reads it. It is owed to a human, by name, and a row marked *owed* that
+ nobody does is a decision the project took in silence.
+
+The distinction is deliberate. A framework that claims CI verifies a UAT teaches its readers
+to stop believing the rest of the table. **E2E is the honest case to look at**: a check can
+read that a module declares an end-to-end command; it cannot read that the command runs
+end-to-end scenarios rather than the unit suite under another name. A rule a one-line alias
+satisfies teaches the alias, so that row is owed to a human.
+
+| Validation | Judged by | prototype | standard | high | critical |
+|---|---|---|---|---|---|
+| Oracle green | machine | ✔ | ✔ | ✔ | ✔ |
+| Lint, format, types | machine | ✔ | ✔ | ✔ | ✔ |
+| Unit tests | machine | ✔ | ✔ | ✔ | ✔ |
+| Fitness functions | machine | ✔ | ✔ | ✔ | ✔ |
+| A frozen contract version proved compatible (V1) | machine | if there is one | if there is one | if there is one | if there is one |
+| Contract tests | owed | if there is a contract | if there is a contract | ✔ | ✔ |
+| Test sheet run by a verifier, with evidence | machine | — | if user-facing | ✔ | ✔ |
+| Runbook present | machine | — | — | ✔ | ✔ |
+| Every scenario re-run at the head commit | machine | — | — | — | ✔ |
+| Build | owed | ✔ | ✔ | ✔ | ✔ |
+| Integration tests | owed | — | per risk | ✔ | ✔ |
+| Security analysis | owed | — | ✔ | ✔ | ✔ |
+| Affected documentation up to date | owed | — | ✔ | ✔ | ✔ |
+| Accessibility | owed | — | if UI | if UI | ✔ |
+| E2E on critical journeys | owed | — | — | ✔ | ✔ |
+| Observability added | owed | — | — | ✔ | ✔ |
+| Rollback verified | owed | — | — | per risk | ✔ |
+| UAT | owed | — | — | as needed | ✔ |
+| Post-deployment verification | owed | — | — | per risk | ✔ |
+
+**Human review is not in this table.** Who must approve a change is not a property of the
+code's blast radius but of the project's exposure — how many people depend on it, and what
+the forge is able to require, and of what the project answers. It lives in `07-governance.md`
+§7: a human code owner — or, where the project answers `approval: agent`, another contributor's
+agent for a `prototype` or `standard` module.
+
+**One round.** The framework asks for **one** sheet, run by **one** verifier who is not an
+author. It never asks for a second adversarial round, and no check counts them. A project may
+decide to spend more — on a module where it is worth it, recorded in its own ADR — and that is
+the project's decision, never a requirement read out of this table. Rounds without a ceiling
+are not free: **a late round introduces defects of its own**, in changes nobody had asked for.
+
+**What separates `high` from `critical`.** At `high` the sheet is required and the verifier is
+independent. `critical` adds one machine row, the one that costs: **every scenario re-run at
+the head commit** after the last fix — no confirmation stands in for a run. And the owed rows
+that `high` leaves to judgement — rollback, UAT, post-deployment verification, accessibility —
+become due. A module that holds a key, places an order, moves money or touches someone's
+personal data is `critical`; one whose failure costs a day is `high`.
+
+> **Never write "tests passing" if the tests were not actually run.** It is the gravest
+> violation in the system, because it corrupts the one thing everything else rests on.
+
+### The test sheet
+
+Reading a diff tells nobody whether the product behaves as needed; an agent reads code as
+well as a human. So a pull request that changes a module the table above asks a sheet of —
+one a user sees, from `standard` up, and any module of criticality `high` or `critical` —
+carries a **test sheet** in its description. Editing
+only a module's description — its manifest, `AGENTS.md`, `README.md`, `docs/` — changes no
+behaviour and needs no sheet, a framework update included; a manifest that moves the module's
+criticality or its user-visible surface does change the module. Both are read before and after
+the change, and the stricter applies:
+
+| # | Given · when · then | Kind | Result | Evidence | Commit | Confirmed |
+|---|---|---|---|---|---|---|
+| S2 | Given an account, when the password is wrong, then a message says what to do and the email stays typed | automated | passed | the CI run's trace | `e4f5a6b` | — |
+| S5 | Given a 375-pixel-wide phone, when the keyboard opens, then the button stays reachable | explored | passed | emulator screenshot | `a1b2c3d` | `e4f5a6b` — three fixes under src/, none on this path |
+| S8 | Given a real mailbox, when a reset is asked, then the email arrives | human only — no test mailbox | not verified | — | — | — |
+
+- **Written before the code**, from the acceptance criteria: it is part of the oracle.
+- **Run by a verifier who is not the author**: another agent session with a fresh
+ context, or a human (`.nstack/playbooks/verification.md`). The session that wrote the code
+ shares its misunderstandings. CI compares the verifier's name with the change's authors —
+ the pull request's, the commits' GitHub accounts (read from their noreply addresses; off GitHub
+ no other address names a person), and
+ the sessions their `Agent-Session` trailers name — and refuses a match: a declaration
+ checked against the history, not a proof of identity. Each person named must have a hand on
+ the pull request — an edit of its description, a review or a comment —: a name written over
+ the author's own results is refused.
+- **No result without evidence**, tied to the commit tested. A new commit does not send the
+ whole sheet back:
+ - a commit whose files are exactly the head's **is** the head: a hash changed by a merge
+ that brought nothing sends no scenario back;
+ - an **automated** scenario is **run again** at the head — CI replays it when the module
+ declares `e2e`, so it costs nothing; its Commit cell takes the head commit. Where checks are
+ attested, it stands when nothing its modules read moved since its run: the records of its
+ commit and of the head hold the same `inputs` digest — the modules run, those they consume
+ from or assemble, the files outside the modules, `contracts/` and `platform/` included, the
+ project's records (`docs/project/`, `docs/adr/`, `docs/pdr/`) left out, the engine and the
+ person — and the run is at most 7 days old, the default branch moved by 20 commits at most. A
+ module that reads something it does not declare is the risk: declare it in `consumes` — a
+ record cannot be declared: a check never reads one —, and the default branch's own `Module
+ checks` run catches what was missed once it runs that module. A commit with no passing record
+ of its own is the case to know: `pr-check`'s T4 says so — `nstack attest` with that commit checked out, and
+ its rows stand without running them again —, as it says a digest that differs, with what
+ changed — a module consumed, a shared file; or, when no file did, the modules run or the
+ engine —, or a run past its bound. The forge's run, made at the push, comes before the head's record: where the
+ ruleset requires `nstack / local checks`, it leaves a row that waits only for the head's record to that status, and says so;
+ - one **explored** by hand keeps the commit its evidence was produced on, and the verifier
+ adds a **`Confirmed`** column on the head commit saying **what moved since and why it leaves
+ the result standing**. Reading three fixes is not the same work as driving six scenarios
+ again, and the sheet should not charge the second for the first.
+ - at criticality **`critical`**, nothing stands in for a run: every scenario goes again.
+
+ A confirmation is not a round. A project that wants another adversarial round decides so
+ itself; the sheet never demands one because a fix landed.
+- **Kinds**: *automated* — replayable, run by CI through the module's `e2e` command, or
+ through `test` for a module that declares no `e2e`;
+ *explored* — judged by driving the interface; *human only* — what no agent can run, with
+ the reason, listed apart for the approver.
+- **A scenario that waits on a person** — a device, a real call, a colleague's machine — is
+ not asked in a conversation, which nobody finds again, nor left in a pull request held open
+ for days. It is asked in an **acceptance issue** (on GitHub, its form in `.github/ISSUE_TEMPLATE/`;
+ elsewhere an issue of the forge, or the team's tracker), assigned to
+ whoever runs it; their answer is a comment, and the sheet's Evidence cell links it. The same
+ issue serves a deliverable several pull requests deliver: it says which criterion each
+ sheet holds, and which nobody holds yet. It copies no criterion and sets no state — both
+ stay in the cycle (`06-decisions.md` §9).
+
+ **One issue is one trial, and it is closed when answered.** A person, a system, a set of
+ steps: when each step has its answer, met or not, the issue is closed — by whoever ran it,
+ or by the pull request that records the last answer (`Closes #`). An issue left open
+ "until the deliverable is accepted" tracks nothing: a deliverable tried on three systems,
+ or delivered by two modules, has as many trials, each opened when there is something to
+ run. What a trial did not meet is fixed and tried again in another issue, or said in the
+ cycle; the deliverable's state is never read from an issue being open or closed.
+
+**`Confirmed` is optional**: a sheet no fix has disturbed never carries it. A later confirmation
+joins an earlier one in the same cell, after a `;`, each clause starting with its commit:
+`651e249 — ; deb508f — ` — a colon or a comma after the commit reads the
+same; a refusal quotes the cell it read. The engine's pull
+request check reads the sheet in CI: missing, unfilled, without evidence, verified before the
+head and not confirmed on it, failed. Where checks are attested, each record also keeps the sheet's
+rows as it read them, and the check compares the description with them: an **explored** row whose
+Commit cell moved and whose evidence did not was never explored again, and fails — evidence names
+its run (a link to that screenshot, video or trace), so a new run brings a new one. The commit it
+moved from is the one the first record holding that evidence names: putting it back and confirming
+the head passes, even after a record held the moved cell — and so does any ancestor of that
+commit, where the row was explored before a record held it; a move to a commit that is not its
+ancestor is said. A row a record
+held and the sheet no longer shows is said, unless a line under the sheet says why it left —
+`Removed: S3, S4 — ` —: whoever edits the sheet writes it, and the approver judges it. A rebase or a squash drops the records of the commits
+it rewrites, and what they read with them. Only this pull request's records are read: each names
+the pull request it was made for — its number where the forge gives it, and its branch, the one
+the checkout tracks — so a branch started on another's never reads that one's sheet. Attest on the
+pull request's branch, one tracking it, or detached; a branch of another name is another's. The approver decides on the sheet; where the project answers
+`approval: agent`, the approver of a `prototype` or `standard` module may be the verifier itself,
+an agent under another identity than the author's (`07-governance.md` §7).
+
+---
+
+## 8. The closing summary
+
+An imposed format, always in this order:
+
+```
+DONE what was changed, one sentence per change
+VERIFIED the checks actually run, with their result
+ASSUMED the assumptions taken for lack of information
+NOT VERIFIED what was not tested, and why
+RISKS possible side effects, debt introduced, follow-ups needed
+```
+
+The last three sections are the most important and the most often skated over. A summary
+with nothing to put under `ASSUMED` and `NOT VERIFIED` is almost always an incomplete
+summary, not a perfect task.
+
+---
+
+## 9. Rules for changing code
+
+**Before.** Understand the problem, look for what already exists, identify the local
+conventions, the dependencies, the tests and the contracts concerned, assess the risks.
+
+**During.** Stay inside the scope. The minimal change. **No opportunistic refactoring.**
+Keep the module's existing conventions, even where you would have written them
+differently. Do not introduce unnecessary complexity.
+
+**After.** Inspect the diff line by line. Run the validations. Actively look for side
+effects. Update the documents affected.
+
+### On refactoring
+
+Never refactor because the code "could be cleaner". A refactor must have a named reason:
+removing coupling, reducing a measured complexity, enabling an identified evolution,
+fixing an architectural violation, improving a measured performance, improving
+testability, paying down documented debt.
+
+A significant refactor is **isolated from the functional change**, in its own pull
+request. Mixing the two makes review impossible: the reviewer can no longer tell what
+changes the behaviour from what preserves it.
+
+---
+
+## 10. Postures
+
+One person or one agent can hold several postures in a small team — except that the author
+never verifies its own work, and never approves it.
+
+| Posture | Held by | Mission | Never | Produces |
+|---|---|---|---|---|
+| **Framer** | An agent | Interview the decider; propose the charter, the cycle, the deliverables and their criteria, the modules | Decide; propose more than the need; split on day one without a reason | Proposals (`.nstack/playbooks/framing.md`) |
+| **Author** | An agent | Deliver one deliverable, in one module, within its criteria | Widen the scope; verify or approve its own work | The pull request and its oracle |
+| **Challenger** | An agent session other than the framer's, or a human | Attack a discovery: pre-mortem, the four risks, counter-evidence | Rewrite the document; soften an objection | Objections with their evidence (`.nstack/playbooks/discovery.md`) |
+| **Verifier** | An agent session other than the author's, or a human | Run the test sheet against the change, before reading the diff | Fix the code; report a preference as a gap | Results and evidence (`.nstack/playbooks/verification.md`) |
+| **Approver** | A human code owner — or, on `approval: agent`, another agent for a `prototype` or `standard` module | Decide the merge on the evidence | Approve without the sheet where one is required; approve what it pushed | The approval |
+| **Decider** | The human who owns the project | Validate the charter, the cycle and its appetite; accept a change of scope; choose at the circuit breaker | Extend a cycle silently | Decisions recorded in `docs/project/` |
+| **Owners** | The foundation team, a module's owner | Own the project's rules, or one module | Write a project rule into a framework file | The project's and the module's documents |
diff --git a/docs/os/06-decisions.md b/.nstack/handbook/06-decisions.md
similarity index 59%
rename from docs/os/06-decisions.md
rename to .nstack/handbook/06-decisions.md
index a106895..893f1b9 100644
--- a/docs/os/06-decisions.md
+++ b/.nstack/handbook/06-decisions.md
@@ -135,6 +135,11 @@ A replaced decision is **superseded by a new decision**, never rewritten quietly
history of abandoned decisions is often worth more than the current one: it explains why
the apparently obvious does not work.
+A record is a file of `docs/adr/`, named `NNNN-verb-phrase-title.md` — `0001-adopt-postgres.md`
+— and listed in that folder's index, which the project keeps. There is one such folder, at the
+project's root: a decision about one module says so in its `Scope` field, and no module keeps a
+register of its own.
+
### PDR — Product Decision Record
For an important **product** decision: a user goal, an expected behaviour, a trade-off, a
@@ -145,10 +150,13 @@ The PDR describes **what the product must do and why**, never its implementation
Minimum content: the user problem · **prior art** · options · decision · a **dated
success criterion** · a **removal condition** · impacts.
+A record is a file of `docs/pdr/`, named `NNNN-user-oriented-title.md`, and listed in that
+folder's index.
+
### Why only two formats
The **FDR** (Functional Design Record) format was removed. Between the PDR (the what and
-the why) and the issue's acceptance criteria (the expected, testable behaviour), almost
+the why) and the deliverable's acceptance criteria (the expected, testable behaviour), almost
nothing was left to justify a third format — and one more format means one more place to
look, one more to maintain, one more that will diverge.
@@ -174,7 +182,11 @@ Every `BUILD` decision, every PDR, and every ADR that deviates from the conventi
carries a sentence of this form:
> *We will consider this was the right call if* **\** *is
-> observed before* **\**.
+> observed before* **\**.
+
+The due date is written in bold, `**2027-01-31**`, and only it: a plain date in the criterion —
+an amendment's, a reference's — is never read as one (C10). A criterion with no bold date and no
+cycle named, whose plain date a closure reached, is reported so its due date is bolded, not lost.
Without a date nobody ever comes back to check, and `docs/adr/` becomes a graveyard —
which is worse than no documentation at all, because it inspires false confidence.
@@ -209,8 +221,8 @@ flowchart TD
AU --> REV["REVIEW AT THE DEADLINE"]
AU2 --> REV
REV --> REV1{"Success criterion
met?"}
- REV1 -->|Yes| CONF["Confirm
+ a new deadline when relevant"]
- REV1 -->|No| SUP["Supersede, correct
or remove"]
+ REV1 -->|Yes| CONF["Met: confirmed
+ a new deadline when relevant"]
+ REV1 -->|No| SUP["Missed: supersede,
correct or remove"]
style PA fill:#1f2937,color:#fff
style AU fill:#065f46,color:#fff
@@ -221,8 +233,10 @@ flowchart TD
almost every project skips.
The `REVIEW AT THE DEADLINE` step is the one missing from nearly every project. A light
-ritual is enough: once a quarter, list the decisions whose criterion has come due, and
-decide — confirmed, superseded, or the feature is removed.
+ritual is enough: at each cycle's closure, `nstack plan` names the decisions whose criterion
+has come due (C10, a warning); the closure's pull request gives each one line under its
+criterion — met, missed, or superseded — approved with the closure. A missed one is the
+decider's to answer, by a decision of its own: superseded, or the feature removed.
---
@@ -266,7 +280,7 @@ denounces: a rule that is only text produces no behaviour.
| A mandatory **Deviation** section as soon as the decision departs from the convention, with the user value and the observation criterion | A decision marked "deviation" without the section → red |
| Every new dependency declares **adoption and exit strategy** in the manifest | Undeclared dependency → red |
| `BUILD` decisions: a **dated success criterion** is mandatory | No date → red |
-| A deadline passed without review | A CI warning, raised at the quarterly ritual |
+| A deadline passed without review | A CI warning at each cycle's closure (C10) |
As long as one of these checks is not automated, it happens in review and sits in the
automation backlog (`07-governance.md` §9): writing "red" is not enough to make it true.
@@ -287,16 +301,95 @@ Every important piece of information has one identifiable source, and only one.
|---|---|
| Product decision | PDR |
| Technical decision | ADR |
-| Expected behaviour of a feature | The issue's acceptance criteria |
+| Expected behaviour of a feature | The deliverable's acceptance criteria |
| Interface between modules | The versioned contract |
| A module's identity and dependencies | MANIFEST |
-| Work to be done | Issues / the project board |
+| Planned work | The current cycle's deliverables, in `docs/project/cycles/` |
+| A deliverable tried by a person | An acceptance issue: what to run and what was seen. It tracks the deliverable; the criteria stay in the cycle, its delivery in the record `nstack deliver` writes |
+| A deliverable's delivery | Its record (`nstack deliver`), read by `nstack plan`, written into the cycle at the closure |
+| Unplanned work | A typed issue: a defect, an architecture question, a debt, a request |
+| What the project must remember | One named issue, the project's log — titled `Log`, opened by whoever writes its first entry; with no forge, `docs/project/log.md`: what was tried, what it cost, what was refused — and what was asked of, promised to, or received from someone outside the team, by any channel |
+| How an agent's tool loads a playbook | The playbook; the skills are generated from it, committed, and checked against it (S3) |
| Real behaviour | Code and tests |
| Quality rules | Versioned CI |
| Infrastructure | Versioned configuration |
-| Security | `SECURITY.md` + automated checks |
+| Security | `.nstack/playbooks/security.md` for the rules, the project's `SECURITY.md` for its policy, automated checks |
| Operations | Runbooks |
> **Never leave an important decision only inside a conversation with an AI.** A
> conversation is not versioned, not reviewable, not enforceable, and not findable by
> somebody arriving in six months.
+
+### What binds is reviewed; what tracks, and what arrives, is an issue
+
+A plan, a decision, a charter and a cycle are **files, reviewed in a pull request**: an issue
+is edited in silence — no diff, no owner, no review — and a plan that can change without
+review is not a plan of record. An issue carries what a file carries badly: a person's trial,
+and whatever nobody planned. The state of the work is in the holds and the delivery records,
+which `nstack plan` reads and the board only shows. Each form names one kind of unplanned work, and none of
+them asks for a deliverable — work a cycle plans is described once, in the cycle. A request
+is not work yet: the next framing makes it a deliverable, or refuses it with a reason.
+
+A project that tracks its unplanned work in another tool, or keeps everything in files,
+breaks no rule here: it has chosen where, which is all this section asks.
+
+---
+
+## 10. The project's documents
+
+The framework writes none of them. It gives each one a form, a moment, and a standard.
+
+```mermaid
+flowchart LR
+ P0["Creation"]:::phase --> P1["Discovery
decided: go"]:::phase --> P2["Charter
accepted"]:::phase
+ P2 --> P3["A module holds
its first code"]:::phase --> P4["Delivery"]:::phase --> P5["Cycle
closed"]:::phase
+ P5 --> P4
+
+ P0 -.-> D0["Forms only:
nothing can be
written yet"]:::owed
+ P1 -.-> D1["Front page:
its sentence"]:::machine
+ P2 -.-> D2["Front page: whole"]:::machine
+ P2 -.-> D2b["Security policy
reviewed"]:::owed
+ P3 -.-> D3["Module map"]:::machine
+ P4 -.-> D4["The module's page
and its runbook"]:::owed
+ P5 -.-> D5["The closure names
what was brought
current"]:::owed
+
+ classDef phase fill:#1e3a8a,color:#fff
+ classDef machine fill:#065f46,color:#fff
+ classDef owed fill:#374151,color:#fff
+```
+
+**Legend** — blue: a moment of the project's life, read from the repository · green: a
+document a check refuses to see left as its form once that moment has come (rule C8) ·
+grey: owed — asked of a human, read by no check.
+
+| Document | Says | Becomes writable when | Then kept current by |
+|---|---|---|---|
+| The idea and its discovery — `docs/project/inputs/`, `discovery.md` | The idea as given; evidence with its sources; the decision | The discovery starts | Each round, until decided |
+| Front page, its sentence — `README.md` | What the product does, for whom | The discovery is decided **go** | — |
+| Charter — `docs/project/charter.md` | Users, problem, constraints, success criteria | The framing | The decider alone (§4) |
+| Front page, whole — `README.md` | What it is, how to run it, where its decisions live | The charter is **accepted** | Each cycle's closure |
+| Security policy — `SECURITY.md` | How to report a vulnerability, who answers, how fast | Creation, as a default; reviewed when the charter is accepted — it says what data the product holds | A change of channel or of maintainers |
+| The project's own rules — `docs/project/rules/` | What this project adds to a playbook, and how each rule is checked | The first decision that binds how the work is done — the language, at a discovery's intake; the charter's constraints, at its acceptance | The decision or the incident that adds a rule; a check that replaces one |
+| The project's tools — `.nstack/tooling-profile.md` | Which tool serves which capability | A tool is chosen | The decision that replaces one |
+| A cycle — `docs/project/cycles/` | One goal, its deliverables, its end date, its closure | The charter is accepted | The decider alone |
+| Module map — `modules/README.md` | The modules, and the contracts between them | A module holds its **first file of code** | The pull request that creates, merges or retires a module |
+| A module's `README.md` and runbook | What it is for, how to start it, how to operate it | The module is created | The pull request that changes its behaviour |
+| What no module owns — `docs/architecture/`, `docs/runbooks/` | How the whole is deployed; what to do when the whole fails | A decision or an incident needs it: absent until then | The next decision, the next incident |
+| A decision and its index — `docs/adr/`, `docs/pdr/` | A trade-off, with its dated criterion | It is taken | Never: a decision is superseded, and the index gains a line |
+
+**A form is not filled before its moment.** At creation nobody knows what the product is;
+a sentence written then is invented. Each form waits for the event of its row, and a check
+that asked for it earlier would be paid in counterfeit.
+
+**The standard** these documents are written to — shape first, a source, a date, current or
+deleted, one home for each fact — is `.nstack/playbooks/documentation.md`: a playbook, because the handbook is never loaded
+into an agent's context and agents write most of these documents.
+
+**What a machine reads, and what is owed.** Three moments are readable from the repository
+and are checked: a front page without its sentence after a go, a front page still a form
+under an accepted charter, a module map still a form once a module holds code. Whether a page is
+*true* is not decidable: it is owed — "affected documentation up to date" in the Definition
+of Done (`05-workflow.md` §7), and the cycle's closure, which names the documents it
+brought current.
+
+This handbook is written to the same standard; that is where it comes from.
diff --git a/.nstack/handbook/07-governance.md b/.nstack/handbook/07-governance.md
new file mode 100644
index 0000000..945694c
--- /dev/null
+++ b/.nstack/handbook/07-governance.md
@@ -0,0 +1,545 @@
+# 07 — Governance
+
+## 1. The principle
+
+> If a rule can be checked automatically, it must **not** depend on the vigilance of the
+> AI or of the developer.
+
+This is the move from *governance by inspection* — somebody reviews and spots things — to
+*governance by rule*: the system refuses the invalid state.
+
+Corollary: **an important rule checked only by human memory will drift.** Not maybe, not
+if the team is careless. It will drift.
+
+---
+
+## 2. Where does this rule live?
+
+This is the central arbitration of the OS and it must be made explicitly, for every new
+rule.
+
+```mermaid
+flowchart TD
+ A["New rule
or convention"] --> B{"Mechanically
checkable?"}
+
+ B -->|Yes| C{"Cost of setting
it up?"}
+ B -->|No| G{"Structural
or situational?"}
+
+ C -->|Low| D["CI: blocking check
+ local hook for feedback"]
+ C -->|High| E{"Risk if
violated?"}
+
+ E -->|High| D
+ E -->|Low| F["Automation backlog
+ a temporary rule in a playbook"]
+
+ G -->|Structural| H["A boundary: repo, package,
ownership, CODEOWNERS"]
+ G -->|Situational| I{"Does it apply to
EVERY task?"}
+
+ I -->|Yes| J["KERNEL
strictly limited budget"]
+ I -->|No| K["PLAYBOOK
loaded by trigger"]
+
+ D --> L["REMOVE the rule from the prompt"]
+ H --> L
+
+ style D fill:#065f46,color:#fff
+ style H fill:#065f46,color:#fff
+ style J fill:#1f2937,color:#fff
+ style L fill:#7c2d12,color:#fff
+```
+
+**Legend** — green: the deterministic destinations · dark grey: the expensive,
+probabilistic one · red: the step everyone forgets.
+
+Node `L` is the most important and the most forgotten: **once automated, the rule leaves
+the prompt**. Otherwise the kernel grows indefinitely and ends up costing, on every task,
+more context than it protects.
+
+Node `H` also deserves attention: a rule that is not checkable but is structural is often
+solved by **structure** rather than by text. "Do not import the other module's code" is a
+weak rule; putting the two modules in distinct packages with declared dependencies makes
+it unnecessary.
+
+**The tree says what kind of place; the level says whose.** Nodes `J` and `K` are the
+framework's. A rule that is the project's alone takes the same path and lands one level
+nearer (`00-overview.md` §5):
+
+| The tree ends on… | A rule every project shares | A rule of this project | A rule of one module |
+|---|---|---|---|
+| `J` — every task | The kernel | `docs/project/rules/always.md` | The module's `AGENTS.md` |
+| `K` — by trigger | `.nstack/playbooks/.md` | `docs/project/rules/.md` | The module's `AGENTS.md` |
+| `D` — a check | The framework's checks | The project's own CI | The module's `check` and `test` |
+
+Node `L` holds at every level: a project rule that a check now enforces leaves
+`docs/project/rules/`. That is what the last column of that folder's form is for.
+
+---
+
+## 3. Fitness functions
+
+> An important rule must not stay in the prompt; it must become an automated test that
+> fails when the architecture drifts.
+
+This is the mechanism that turns this OS's principles into real constraints.
+
+```mermaid
+flowchart LR
+ subgraph SRC["Sources — already present"]
+ S1["The modules'
MANIFESTs"]
+ S2["The real graph extracted
from the code"]
+ S3["Versioned
contracts"]
+ S4["Build & runtime
metrics"]
+ end
+
+ subgraph FF["Fitness functions"]
+ F1["Dependencies:
declared = real"]
+ F2["No cycles"]
+ F3["Layering respected"]
+ F4["No access to another
module's database"]
+ F5["Contracts: compatibility
and consumers"]
+ F6["Budgets: performance,
size, time"]
+ F7["Lifecycle:
statuses and dates"]
+ end
+
+ S1 --> F1
+ S2 --> F1
+ S2 --> F2
+ S2 --> F3
+ S2 --> F4
+ S3 --> F5
+ S1 --> F7
+ S4 --> F6
+
+ FF --> CI["CI — blocking"]
+
+ style CI fill:#065f46,color:#fff
+ style FF fill:#1f2937,color:#fff
+```
+
+**Legend** — dark grey: the checks themselves · green: the blocking verdict. Layering (F3) and
+budgets (F6) are the project's to build: the framework ships no check for them.
+
+### The basic fitness functions
+
+To put in place from the second module onwards, in order of return:
+
+| # | Function | Detects |
+|---|---|---|
+| 1 | Declared graph (manifest) = real graph (code) | A hidden dependency, a stray import |
+| 2 | No circular dependency | Modules that have become inseparable |
+| 3 | No direct access to another module's data | Coupling through the database |
+| 4 | Backward compatibility of contracts | An unintentional breakage |
+| 5 | Consumers of a deprecated version = 0 before removal | A deliberate breakage, badly sequenced |
+| 6 | Consistency of lifecycle statuses | A frozen contract changed, a deprecated module reused |
+| 7 | Deprecation dates not passed | Permanent intermediate states |
+| 8 | One PR = one module | Boundary erosion |
+| 9 | Complete module envelope (manifest, owner, tests) | An orphan module |
+| 10 | Performance and size budgets | A silent regression — the project's to build: no check ships with the framework |
+
+The first six are cheap: they are computed from data already present (manifests, imports,
+contract schemas). There is **no semantic analysis** — these are comparisons of graphs
+and schemas.
+
+Beside them, the engine checks what a shared repository must not carry: a path rooted in one
+person's home directory, in any tracked file (H1). It exists on no other machine and
+publishes the layout of the one it was written on; an image's or a runner's home, a
+folder software keeps its own files in — `~/.config`, or `~/Library` on a Mac — a
+placeholder or a variable is the same everywhere.
+
+### Writing a fitness function
+
+A good fitness function is fast (it runs on every pull request), deterministic (no random
+false positives), and **explanatory when it fails**. One that says only "architecture
+violation" will be worked around; one that says "module A imports `B/internal/x.ts`, but
+A's manifest does not declare B; use contract `b-api@v2`" will be respected.
+
+---
+
+## 4. What to automate
+
+In decreasing order of return:
+
+```
+Immediately, at almost no cost
+ format · lint · type checking · secret detection · commit conventions
+
+From the 2nd module
+ unit tests · build · fitness functions 1 to 3 · one PR = one module
+
+From the 1st inter-team contract
+ schema validation · contract tests · compatibility · consumers
+
+From going to production
+ security analysis · dependencies/CVE · smoke tests · post-deployment verification
+
+When the volume justifies it
+ integration tests · targeted E2E · performance budgets · merge queue
+```
+
+**The critical checks run in CI.** Local hooks give fast feedback but are **never** the
+only barrier: they are bypassable, disableable, and absent on a newcomer's machine.
+
+---
+
+## 5. Quality gates
+
+A quality gate must be: **objective · understandable · reproducible · automated where
+possible · useful**.
+
+The last criterion is the most often forgotten, and it is the one that kills buy-in.
+
+| Situation | Response |
+|---|---|
+| A gate blocks often without ever improving quality | Re-evaluate it or remove it |
+| An important rule never respected | Automate it, remove it, or explicitly reconsider |
+| A gate systematically bypassed by label | The problem is the gate, not the people |
+| A gate so slow that people skip it | Make it fast, or move it later in the pipeline |
+
+> Avoid bureaucratic gates with no value. Every gate has a permanent cost paid by every
+> pull request; it must earn its keep.
+
+**Never a silent bypass.** No `skip`, no `--no-verify`, no test disabled "temporarily",
+no threshold lowered to make things pass. A necessary bypass goes through a visible label
+and leaves a counted trace.
+
+---
+
+## 6. Proportionate governance
+
+**Two things are read before any rule fires, and neither is declared by whoever is judged.**
+The project's *stage* — unframed until its charter is accepted, framed after — decides
+whether the rules that bound work inside a cycle — K1 to K3 and K5 — apply at all
+(`.nstack/handbook/project.md`). The module's *criticality* decides which checks a change pays
+for, in either stage. One never stands in for the other.
+
+The level of requirement depends on the **criticality declared in the manifest**, not on
+a uniform rule. Never impose the ceremony of a critical system on a small module; never
+treat a critical system like a prototype.
+
+**What each of the four values requires is written in exactly one place: the table of
+`05-workflow.md` §7.** This section says why the axis exists and how a module changes value;
+it does not repeat the requirements, because a second copy of a table is a second answer
+waiting to contradict the first.
+
+```mermaid
+flowchart LR
+ A["Module"] --> B{"Declared
criticality"}
+ B --> P["prototype"]:::light
+ B --> S["standard"]
+ B --> H["high"]
+ B --> C["critical"]:::heavy
+ P --> T["05-workflow.md §7
what each one requires"]
+ S --> T
+ H --> T
+ C --> T
+
+ classDef light fill:#1f2937,color:#fff
+ classDef heavy fill:#7c2d12,color:#fff
+```
+
+**Legend** — dark grey: the lightest value · red: the heaviest · the table is the single
+source of what they require.
+
+**The value answers one question**, and it is a question about consequence, not about effort:
+*what does a failure of this module cost?* Nothing, because it is thrown away — a user's
+patience — a day of work — or a key, an order, money, someone's personal data. That is a
+product decision, so **the decider settles it**; an agent proposes it with its price and does
+not choose alone.
+
+Criticality is declared in the manifest, so CI knows which checks to apply to which
+module. It is not decided pull request by pull request, which would trigger the
+discussion at the worst possible moment.
+
+**It is revisable**, by ADR: a module going to production changes value. Raising it takes
+effect on the next run, with no migration; the checks the new value requires apply to the next
+pull request that changes the module.
+
+---
+
+## 7. The repository as an organ of governance
+
+The repository is not storage space: it is where rules become non-bypassable. Mechanisms
+to use (GitHub wording, transposable elsewhere):
+
+| Mechanism | What it guarantees |
+|---|---|
+| Pull requests required | No direct change on the protected branch |
+| Required checks | A red CI blocks the merge, without exception |
+| CODEOWNERS | The right owner is asked automatically — a user, or a team written organisation/team; GitHub reads an organisation named alone as no owner at all |
+| Rulesets / branch protection | The rules do not depend on goodwill |
+| Issue forms | What nobody planned arrives with what is needed to judge it |
+| PR template | The DoD is visible at review time |
+| Labels | Exceptions are visible and counted |
+| Protected environments | Deployment goes through an approval |
+| Dependency / security automation | CVEs do not depend on manual watching |
+| Branches up to date before merging (G22) — or a merge queue, where the forge offers one (organisation repositories) and the checks run on it | Two changes each green on its own base never turn main red together: what was checked is what lands. Updating a branch costs the cheap checks — attested, `nstack attest` on the updated head; a module's are kept while nothing they read moved. How to keep it cheap: `05-workflow.md`, *Up to date before merging* |
+| A dedicated identity for agents | An agent never merges around the approval the project asks for |
+| Rulesets with an empty bypass list | Nobody, administrators included, merges around a rule |
+| Stale approvals dismissed on push | An approval covers the commits its approver read — where the plan has no ruleset, `pr-check` says each approval the head moved past (R1) |
+| A default code owner — on `approval: agent`, a human owner where one must approve | The code owner review covers every path a human must approve |
+| A record of what landed | Nothing reaches the protected branch in silence — it records, it never refuses |
+
+> **Critical rules must not be bypassable by an instruction given to the AI.** That is
+> the ultimate test of governance: if asking an agent nicely is enough to get around it,
+> the rule does not exist.
+
+**And when the forge cannot enforce any of it.** Every mechanism above depends on what the
+repository's plan allows; on some, none of them is available, and nothing refuses a merge at
+all. The diagnosis says so in one word — *unguarded* — and what remains is the last row: a
+run that fails when a commit reached the protected branch outside a pull request. That is a
+record, not a barrier, and it is worth exactly what a record is worth: the thing nobody would
+otherwise have been told. Reading it as a guarantee is the mistake it exists to prevent.
+
+**Off GitHub**, this version reads none of the forge's settings and ships no CI there: `doctor`
+lists what the forge should refuse, never reports it in place, and says the repository
+*unguarded*; each change's checks are attested; the record of commits on main does not run. The
+forge's own protections still hold — set them as `INSTALL.md` lists them — but nothing here
+vouches for them. With no forge at all, nothing refuses a change but the team.
+
+**And when the forge cannot run the checks.** A runner down, the hosted minutes spent, a team
+that works off the forge: the checks still run, where the team works. `nstack attest` runs the
+CI's own checks — one list, bound to the workflows by a test — on a clean head, and records the
+run on the commit in git (`refs/notes/nstack/checks`, pushed with the branch), shown — on GitHub only —
+as `nstack / local checks`, a name no CI job has. Such a change is **attested**, never
+*checked*: the record makes a claim traceable — who ran it, on which commit, with what output
+— not true. Whether a record stands in for the forge's CI is the decider's word, the project's
+answer `checks: attested` in `.copier-answers.yml`, changed in a pull request (`nstack config checks
+attested` lays it on a branch); `pr-check` then
+requires a complete, passed record of the head (A1, A2) — on the workstation and in the forge's
+CI alike, which reads the record from the remote's notes with the job's token: an unattested head
+is red there too. A record CI cannot read — no token, a remote that refuses — is said as a
+warning, never called compliant in silence. Attesting again once the test sheet is filled keeps the
+module checks the commit's record passed — they read the tree and the base, never the description —
+when the base commit, the engine and the person are the same, and the engine is published or named
+by a commit with no change of its own — tracked or not. The record says which run they come from
+(`kept_from`), with that run's evidence; what the tree's ignored files, the environment or the tools
+outside it hold is not compared: `nstack attest --again` runs them. They are also kept
+across commits — a merge of the default branch that touched nothing they read: their modules,
+those they consume from or assemble, `contracts/`, `platform/` and the files outside the modules but the
+project's records (`docs/project/`, `docs/adr/`, `docs/pdr/`) — while the
+digest of what they read is unchanged, for 7 days and 20 default-branch commits at most. A record
+known to be unsound — two runs that shared what a run must not share, a tool found lying — is
+voided: `nstack attest --void --reason ""` adds a line naming who, why and every
+run the commit's note holds. None of them is a record afterwards, nor kept from — on its commit, or
+through another commit's record that kept from it —, and `pr-check` refuses a head whose record
+is voided or keeps a check from a voided run, until it is attested again. The runs stay in the
+note: evidence is never rewritten. A void travels as a record does, under the same identity
+rule; the status on the forge turns to *voided* only with a token that may write it. Where the answer is `forge`, a record is
+information, and on a guarded repository the forge's required checks stay the barrier — a
+decider who wants the record to gate a protected branch requires its name at the forge.
+Where the answer is `attested`, requiring it is what keeps a pull request moving: the record
+holds the description's sheet, so it is made after its last edit, and notes start no run — the
+pull request's last run, from before the record, would stay red. The status is the record's own
+event: when the base branch's ruleset requires `nstack / local checks`, the pull request's run
+leaves A1 and A2 to it, and says so — and T4 too, for an automated row that waits only for the
+head's record: attest's own run keeps the row or fails it with the head's inputs digest. Posting it needs a token that may write commit statuses
+(an agent's App made by `nstack agent add` has it; an older App gets Commit statuses: write in
+its settings, accepted on its installation); without one, the record is said *not shown*, and
+the merge waits. A required name is matched by any check of that name: where every record is an
+agent's, the ruleset can pin the status's source to the agent's App.
+
+The record names who ran it, as git would sign a commit made in that checkout, and travels to the
+remote with the notes: it never publishes an address the project's history does not already show.
+A checkout whose identity is unknown there — a fresh clone falls back on the workstation's own,
+often personal — is refused before any check runs; set the checkout's identity, or, for a first
+record of a new contributor, `nstack attest --accept-identity`. GitHub's noreply address is always
+accepted, and enough. A repository with no remote is never refused: nothing travels.
+
+**A dependency bot's pull request, where checks are attested.** Dependabot's — or Renovate's —
+pull requests carry no record, and the bot takes commands only from people with push access: an
+agent's App asking it to rebase is refused. Nothing is re-applied by hand. When the branch is
+behind and the ruleset asks it to be up to date, a person's `@dependabot rebase` keeps the bot
+maintaining it; otherwise the agent updates it on the forge
+(`gh api --method PUT repos///pulls//update-branch`, which the App's pull
+requests and contents write permissions allow, both given by `nstack agent add` — where the
+update touches workflow files, the App also needs the workflows permission, `nstack agent add
+--workflows`). The bot then stops maintaining that pull request: a conflict or a newer version is
+a person's `@dependabot recreate`. The agent fetches the base and the head together and checks
+the head out as it stands (`git fetch origin main pull//head:refs/remotes/origin/pr/
+&& git checkout --detach origin/pr/`), then runs `nstack attest`: the record names who ran
+the checks, never who wrote the commit, and each new head is attested again. The route covers
+updates outside the modules; a bot's update inside one is delivery work like any other, with its
+deliverable or the out-of-cycle label.
+
+**A record is published with the repository**: the notes are pushed, and every step's output
+travels in them. `nstack attest` writes the checkout's root as `` and the home folder as `~`,
+whole folders only. Anything else a step prints travels as printed, and is the step's to keep out:
+a host name, a token a test echoes, a user name in a path outside the home — `/tmp/pytest-of-/`
+in a failed test's output. The SHA-256 of each step is of its output as it ran, so it is not
+recomputed from the record. A record an earlier
+version pushed keeps its paths: notes are history, and rewriting them rewrites the evidence
+`pr-check` reads.
+
+**A failed check says what failed, and keeps its output on the workstation.** Under the check's
+FAIL line, `nstack attest` shows the last lines a module's own command wrote before it exited — a
+test runner's summary names the test that failed — and the path of the check's whole output, in
+the clone's git folder (`.git/nstack/attest/-.log`, a worktree's own git folder in a
+worktree), never in the tree and never pushed. A test that fails once and passes again is named there: quarantine it by that name
+(`.nstack/playbooks/tests.md`).
+
+### Agents and approval
+
+A pull request's author cannot approve it. An agent working with a human's credentials
+*is* that human: it can approve a colleague's pull request in their name, then merge. Four
+settings close that door, and they only hold together:
+
+1. **The agent has its own identity** — on GitHub, an App installed on the repository (`nstack agent add `: made and
+ installed in two clicks, with a clone that works as it and runs the project's hooks): tokens
+ that expire within the hour, never the Administration permission; elsewhere, a bot account
+ with the same limits. Its session reaches no human credential — no SSH key, token or
+ command-line login of a human: `nstack agent run` keeps the person's tokens, SSH agent and
+ git configuration out of its environment; a sandbox, a container or a dedicated system user
+ keeps it out of their files. The agent's tool still reads the person's own configuration — its
+ sandbox, hooks and permissions: for Claude Code, the command adds settings of the agent's own
+ that open the forge to its sandbox, nothing else. A person's hook that refuses `gh`, against
+ their own account, lets an agent's session through on one test only — its `gh` is the App's:
+ `[[ -n "${NSTACK_AGENT:-}" && "$(command -v gh)" == "$(dirname "$GH_CONFIG_DIR")/bin/gh" ]] && exit 0`
+ — the agent's `gh` folder sits beside its shim, wherever the agents' folder is.
+ Inside that sandbox the agent writes its clone, `.git/config` excepted, and a cache of its own
+ (`XDG_CACHE_HOME`; uv and pre-commit keep the person's); a build writing elsewhere, such as
+ Cargo's `~/.cargo`, needs the person to add that folder to their sandbox's `allowWrite`. It
+ branches without tracking and pushes plainly — `git switch -c d4-export origin/main`, then
+ `git push` — and needs no worktree, its clone being its own. Unix sockets
+ stay closed unless the project answers `agent_sockets: true` in `.copier-answers.yml`, read from
+ the default branch: an end-to-end test of audio or a display needs them, and a socket such as
+ `docker.sock` hands the agent the host.
+ Dispatching a workflow run needs Actions: write, which its App never has; changing a file under
+ `.github/workflows/` needs Workflows, which only `nstack agent add --workflows` grants. Both are
+ otherwise the person's gestures. The agent hands over the literal command (`gh workflow run --ref `) and
+ never asks another session to make it — that would be one identity borrowing another's rights.
+2. **The merge requires a human code owner's approval**, and `CODEOWNERS` starts with a
+ default owner: an App can approve, but it is never a code owner. On `approval: agent`, below,
+ the code owners file names a human only where one must approve.
+3. **Nobody is on the rulesets' bypass list**, administrators included.
+4. **An approval is dismissed when new commits are pushed**: otherwise a force-push after
+ the approval merges content its approver never read. Where the plan has no ruleset to
+ dismiss it, the forge still shows *approved*: `pr-check` says each approval the head moved
+ past (R1), and nobody merges on it until its approver has approved the head.
+
+The human who drove the agent may approve its pull request. A team that wants four eyes
+adds "require approval of the most recent reviewable push", or a second reviewer.
+
+**Where another agent approves.** A project whose agents each work under an identity of
+their own may answer `approval: agent` in `.copier-answers.yml` — the
+decider's word, changed in a pull request a human approves: `nstack config approval agent` lays it on
+a branch, the code owners file following it. A change to a `prototype` or `standard`
+module is then approved by a human **or** by another agent — under an identity that is neither its
+author's nor its last pusher's, whoever runs it; everything else still waits for a human code owner.
+The forge does the sorting, path by path:
+
+- **The code owners file names a human** for the project's rules (`AGENTS.md`, `CONTRIBUTING.md`,
+ `SECURITY.md`, `.nstack/`, the forge's folder, the code owners file itself, the hooks'
+ configuration, `.copier-answers.yml`), its records (`docs/`) and every module neither
+ `prototype` nor `standard` — and **no default owner**: a path it does not name needs one
+ approval, an agent's counting. The code owners review stays required: nothing is lowered.
+ `nstack new-module` writes no line for a `prototype` or `standard` module; a module whose
+ criticality rises gets its line in the same pull request (`doctor`, L6).
+- **The last pusher's approval does not count** (G21): an agent that pushed a fix to the change
+ it reviews no longer approves it.
+- **The approving agent says, in its approval**, the session it ran in and what it is expert in
+ for the module. Where the module asks for a test sheet, it is the verifier who ran it; where
+ it asks none, it reviews the change on its oracle and its checks.
+- **Independence is the identity's, not the person's.** Two agents one contributor runs —
+ each under its own App, in its own session, best on another model — approve each other's
+ changes as two contributors' agents would. What a second agent cannot do, nobody's can: approve
+ what a human must, or what it pushed. So the answer changes nothing until a second agent works
+ under an identity of its own; `doctor` says so while the history shows a single one.
+- **Two agents never loop.** The reviewing agent approves or comments — never *request
+ changes*, a block only it can lift — and never pushes to the change it reviews: it names what
+ is wrong, the author fixes. One round (`05-workflow.md`): its findings once; then it confirms
+ the fixes and approves, or, still disagreeing, hands the change to a human. A second pass
+ raises nothing new but what the fixes broke.
+
+**Copilot's code review is not that agent.** GitHub lets its approval count toward the required
+ones — generally available since 2026-10-28, off by default: *Settings › Copilot › Code review*,
+*Allow Copilot approvals to count toward merge requirements*, which an organization may also
+enforce for every repository. It runs no test sheet and names no session, so leave that toggle
+off, and ask the organization's owner where it is enforced; where an approval of it is the only
+one, `pr-check` says so (R2). Copilot is named in no code owners file, so on every path the file
+names a code owner still approves — GitHub's documentation says nothing otherwise.
+
+**Where the forge cannot guard** — a private repository on a plan that enforces no ruleset —
+neither answer is enforced: the code owners file only asks for reviews, and `doctor` says
+*unguarded*. Who approves is then the team's rule, kept by the people, as every rule there is.
+
+Whether the answer holds is read on what escapes: a defect found within 30 days of a merge,
+which the bug form ties to its pull request (`10-measurement.md`). GitHub counts an App's approval
+toward the required ones once the App may write contents, never on a pull request it opened — as
+reported in practice; a project's first cross-approved pull request is its own proof.
+
+### The approval is one gesture, not three
+
+Approving and merging are two different acts, and only the first is a judgement. With
+**auto-merge** allowed on the repository, the author arms it on the pull request when opening
+it (`gh pr merge --auto --squash`), and the pull request merges itself the moment it
+is approved and its required checks go green: nobody waits on the reviewer to come back and
+press a button, and no agent is told to merge on their behalf. The barrier is untouched — the approval is still
+required, still a human's or, under `approval: agent`, another agent's (above), still dismissed
+when new commits are pushed, a merge of the default branch included (`05-workflow.md`).
+
+What it removes is the round trip: **the approval message that carries no judgement at
+all**, and exists only to tell an agent that a merge could now happen.
+
+The approval itself can also be given from wherever the decision was made, under the
+approver's own identity, rather than by walking to the browser:
+
+```
+gh pr review --approve
+```
+
+One gesture. An approval given in the terminal and an approval given in the web interface
+are the same act, recorded the same way, and dismissed the same way on the next push.
+
+---
+
+## 8. The CI pipeline
+
+Conceptual order, from the fastest to the most expensive — useful feedback arrives early.
+
+```mermaid
+flowchart TD
+ CH["Change"] --> F1["Format · Lint"]
+ F1 --> F2["Types"]
+ F2 --> F3["Unit tests"]
+ F3 --> F4["Build"]
+ F4 --> F5["Architecture
fitness functions"]
+ F5 --> F6["Contracts:
schema · compatibility"]
+ F6 --> F7["Security:
secrets · dependencies · SAST"]
+ F7 --> F8["Integration tests"]
+ F8 --> F9["E2E · visual · accessibility
per criticality"]
+ F9 --> AR["Artefact"]
+ AR --> DE["Deployment"]
+ DE --> SM["Smoke tests"]
+ SM --> OB["Verification through
observability"]
+
+ F1 -.->|"failure = immediate stop"| STOP["Feedback under 2 min"]
+ F5 -.->|"failure = architectural
violation"| STOP2["A precise explanation
+ the rule broken"]
+
+ style F5 fill:#065f46,color:#fff
+ style F6 fill:#065f46,color:#fff
+ style STOP fill:#1f2937,color:#fff
+ style STOP2 fill:#1f2937,color:#fff
+```
+
+**Legend** — green: the architecture gates · dark grey: what a failure must give back.
+
+**Do not apply every step mechanically to every module.** The level of validation is
+proportionate to the risk (§6).
+
+**Feedback time is a quality property.** A thirty-minute CI is a CI people work around,
+launch at the end of the day, and whose results they ignore. Feedback time is a tracked
+indicator (`10-measurement.md`).
+
+---
+
+## 9. The automation backlog
+
+Every rule that *should* be automated but is not yet is identified debt, not a fact of
+life. It sits in a dedicated backlog, with:
+
+- the rule and where it lives temporarily (a playbook, a local AGENTS.md);
+- the risk if it is violated;
+- the estimated cost of automating it;
+- the trigger that will make it a priority.
+
+That backlog is reviewed on the same rhythm as the decision review (`06-decisions.md`
+§6). It is the mechanism that stops the kernel growing: every rule added to the prompt
+arrives with its planned exit date.
diff --git a/docs/os/08-quality.md b/.nstack/handbook/08-quality.md
similarity index 89%
rename from docs/os/08-quality.md
rename to .nstack/handbook/08-quality.md
index f80808e..0e933ff 100644
--- a/docs/os/08-quality.md
+++ b/.nstack/handbook/08-quality.md
@@ -1,7 +1,7 @@
# 08 — Quality and risk
> This document is the **reference**. The matching operational rules live in
-> `playbooks/`, loaded on demand by an agent.
+> `.nstack/playbooks/`, loaded on demand by an agent.
---
@@ -122,12 +122,12 @@ It **does not replace** unit, integration, security or technical tests. A UAT us
technical safety net is the symptom of an insufficient test suite — and it arrives too
late and costs too much for that role.
-It starts from the acceptance criteria of the PDR or the issue and from real user
+It starts from the acceptance criteria of the PDR or the deliverable and from real user
journeys, not from free exploration of the interface.
The test sheet (`05-workflow.md` §7) is the everyday form of acceptance: the acceptance
criteria turned into scenarios, run by someone other than the author, each with its
-evidence. UAT remains for `critical` modules, on top of it.
+evidence. UAT remains for `critical` modules on top of it, and for `high` ones as needed.
---
@@ -153,14 +153,21 @@ rate limiting · isolation · backups · disaster recovery
- The checks that can be automated are **built into the delivery cycle**, not run
occasionally.
-The operational detail is in `playbooks/security.md`, loaded as soon as a task touches
+The operational detail is in `.nstack/playbooks/security.md`, loaded as soon as a task touches
authentication, authorisation, secrets, personal data or external input.
---
## 7. Reliability and operations
-A module destined for production must be **operable**. Depending on its criticality:
+A module destined for production must be **operable**. This section says **what** operability
+is made of; **when** each capability is required is read from the one table that answers that
+question, `05-workflow.md` §7. Below `standard` — a `prototype` module, thrown away, that
+nothing depends on — none of it is required.
+
+The rows below are **owed to a human**, except the runbook's presence, which M8 checks. They
+are the detail behind the *Observability added*, *Runbook present* and *Rollback verified*
+rows of the table, and where a cell here and the table differ, the table decides.
| Capability | standard | high | critical |
|---|---|---|---|
@@ -175,14 +182,14 @@ A module destined for production must be **operable**. Depending on its critical
| Idempotence | case by case | ✔ | ✔ |
| SLI / SLO | — | as needed | ✔ |
| Runbook | — | ✔ | ✔ |
-| Tested rollback | — | ✔ | ✔ |
+| Tested rollback | — | per risk | ✔ |
| Controlled degradation | — | as needed | ✔ |
> **Never add automatic retries without analysing the side effects.** A retry on a
> non-idempotent operation duplicates. A retry without backoff turns a local incident
> into a general outage. A retry that masks an error prevents it being detected.
-Detail: `playbooks/operations.md`.
+Detail: `.nstack/playbooks/operations.md`.
---
@@ -210,7 +217,7 @@ integrity · security · observability
The schema evolves through the same expand/contract logic as contracts
(`03-contracts.md`): add, let both coexist, migrate, remove. Never rename in place.
-Detail: `playbooks/data-migration.md`.
+Detail: `.nstack/playbooks/data-migration.md`.
---
diff --git a/docs/os/09-platform.md b/.nstack/handbook/09-platform.md
similarity index 66%
rename from docs/os/09-platform.md
rename to .nstack/handbook/09-platform.md
index 7478b55..11efad5 100644
--- a/docs/os/09-platform.md
+++ b/.nstack/handbook/09-platform.md
@@ -32,7 +32,7 @@ flowchart TB
classDef module fill:#065f46,color:#fff
```
-**Legend** — blue: the engine, an external tool named in `docs/tooling-profile.md` · dark
+**Legend** — blue: the engine, an external tool named in `.nstack/tooling-profile.md` · dark
grey: the foundation, which the project owns and adapts · light grey: a `platform/`
module, only when the project builds its own shared mechanisms · green: the teams'
modules. Solid line: generation and rules; dotted: execution or use.
@@ -56,19 +56,48 @@ section, with its own stack's commands.
| `check` | All the fast validations: format, lint, types | In under 2 minutes |
| `test` | The module's test suite | With no dependency on another module |
| `run` | Start the module locally | With doubles for the dependencies |
-| `e2e` | The module's end-to-end scenarios; evidence written to `.evidence/` | Against the running module, in CI |
+| `e2e` | The module's end-to-end scenarios; logs and screenshots written to `$NSTACK_EVIDENCE` (`.evidence/e2e/`), read after the run; exit 77 when it cannot run here. One at a time on a machine: a second waits for the first, whichever project or command started it, and says for whom, again every minute; a module whose run is sealed (`evidence.sealed: true`) neither waits nor holds | Against the running module, in CI |
+| `clean` | Remove what the module's commands left in its folder — build outputs | After its checks in CI on a self-hosted runner, even failed ones |
| `compat` | Tell whether a change to a contract version is compatible: exit 0 when `$NSTACK_HEAD_PATH` accepts what `$NSTACK_BASE_PATH` did | On the module holding contracts, once one is consumed or stable |
| `contracts` | Validate and generate the contract artefacts | On every contract change |
| `migrate` | Apply the data migrations | When the module owns data |
-| `release` | Produce the shippable artefact | Reproducibly |
+| `release` | Produce the module's shippable artefacts into `$NSTACK_DIST` | Reproducibly, for the platform its arguments name |
-The engine runs `bootstrap`, `check`, `test`, `run`, `e2e` and `compat`: it reads the command from
+The engine runs `bootstrap`, `check`, `test`, `run`, `e2e`, `clean`, `compat` and `release`: it reads the command from
the manifest and launches it from the module's folder, locally as in CI. `check` and
`test` are mandatory as soon as the module holds anything beyond its description — its
-manifest, `AGENTS.md`, `README.md`, `docs/`; `bootstrap` and `e2e` are optional. A new module
+manifest, `AGENTS.md`, `README.md`, `docs/`; `bootstrap`, `e2e` and `clean` are optional. A new module
holds only its description: its verbs report that there is nothing to run yet, and
-`nstack fitness` asks for `check` and `test` with its first other file. `contracts`,
-`migrate` and `release` are reserved names, to declare when a module needs them.
+`nstack fitness` asks for `check` and `test` with its first other file. `contracts` and
+`migrate` are reserved names, to declare when a module needs them.
+
+What a module's checks need from the CI machine — a kernel setting, a system package — is its
+`bootstrap`'s, which `Module checks` runs before `check` and `test`: the manifest is the
+project's, and `nstack update` keeps it. Never a step added to the framework's workflow, which
+the next update rewrites, nor one asked of every project for one module's need. Guard it to CI
+(`GITHUB_ACTIONS`) so that a developer's machine is left as it is.
+
+**What ships is assembled from artefacts, never from another module's folder.** `nstack
+release ` runs the module's `release` with `NSTACK_DIST` naming its own folder of the
+project's `dist/` — emptied first, outside every module, never committed — and passes what
+follows the module's name to its command: the platform, the target, the variant — a binary, a
+mobile build, a web bundle, an installer, whatever the stack ships. A module that makes what a
+user installs from other modules' artefacts declares them in its manifest, `assembles:
+[, …]`, and reads them in their folders (`$NSTACK_DIST/..//`); `nstack
+release` with no module runs each after what it assembles, and fails on a module declaring
+none only when that module is named. One target for every module — a platform, an
+architecture — is set in the environment they all inherit (`TARGET=… nstack release`); a module
+needing several targets of another's makes them all in that one's release, since each release
+empties its folder and names what it removed. So does a project shipping one package per system from one
+checkout — a `.deb` and an `.rpm`: one release makes both, or the first is moved out of `dist/` before
+the second is made. Reading another module's artefacts without declaring it fails (`B9`), as a
+path into its folder does (`B2`); `assembles` names modules by their folder, as the verbs do.
+
+**A job leaves nothing behind.** GitHub's hosted runners are thrown away after each job; a
+self-hosted one is not. The module checks start on a clean checkout, and each module ends
+with its `clean`, even after a failure — so a module whose commands write build outputs declares how
+to remove them, and keeps them inside its own folder, where both reach them. What the
+machine accumulates outside any checkout — images, logs — is its owner's to clean.
**Why this is the foundation of multi-team work.** A developer or an agent arriving on an
unknown module does not have to discover whether to run `npm`, `make`, `cargo`, `pytest`
@@ -87,50 +116,44 @@ a bad boundary (`02-modules.md` §9).
project/
│
├── AGENTS.md # the OS kernel
-├── README.md
+├── README.md # the product's front page: a form at creation, then the project's
├── CONTRIBUTING.md
├── SECURITY.md
│
-├── docs/
-│ ├── os/ # this documentation
-│ ├── architecture/ # overview, system diagrams
-│ ├── project/ # the discovery, the charter and the cycles: what the framework cannot know
+├── docs/ # the project's own, and nothing else
+│ ├── project/ # the discovery, the charter, the cycles, the project's rules
│ ├── adr/ # cross-cutting technical decisions
│ ├── pdr/ # product decisions
-│ ├── runbooks/ # cross-cutting operations
-│ └── tooling-profile.md # mapping capabilities → the tools of the moment
-│
-├── playbooks/ # AI instruction modules, loaded on demand
-│ ├── discovery.md
-│ ├── framing.md
-│ ├── security.md
-│ ├── tests.md
-│ ├── verification.md
-│ ├── data-migration.md
-│ ├── ux.md
-│ └── operations.md
-│
-├── contracts/ # ← a module in its own right, dedicated owner
-│ ├── MANIFEST.yaml
-│ ├── /
-│ │ ├── v1/
-│ │ └── v2/
-│ └── tests/
+│ ├── architecture/ # how the whole is deployed — created by the first decision that needs it
+│ └── runbooks/ # what to do when the whole fails — created by the first incident
│
├── modules/ # empty at creation
│ ├── /
│ │ ├── MANIFEST.yaml
│ │ ├── AGENTS.md
│ │ ├── README.md
-│ │ ├── docs/adr/
│ │ ├── src/
│ │ └── tests/
│ └── /
│ └── …
│
-└── .github/
- ├── ISSUE_TEMPLATE/
- ├── workflows/
+├── contracts/ # ← a module in its own right, dedicated owner; created by the first contract
+│ ├── MANIFEST.yaml
+│ ├── /
+│ │ ├── v1/
+│ │ └── v2/
+│ └── tests/
+│
+├── .nstack/ # the framework's one folder: everything in it arrives by update
+│ ├── playbooks/ # AI instruction modules, loaded on demand
+│ ├── forms/ # what a command or a playbook copies: charter, cycle, decision, rules
+│ ├── handbook/ # this documentation, INSTALL.md and RULES.md
+│ ├── tooling-profile.md # mapping capabilities → the tools of the moment
+│ └── skills.yaml # playbooks exposed as skills
+│
+└── .github/ # on GitHub; elsewhere CODEOWNERS at the root, and the
+ ├── ISSUE_TEMPLATE/ # pull request form where the forge reads it
+ ├── workflows/ # (.nstack/handbook/INSTALL.md)
├── CODEOWNERS
└── pull_request_template.md
```
@@ -154,7 +177,7 @@ flowchart TD
B --> C1["MANIFEST pre-filled
owner organisation/team"]:::generated
B --> C2["AGENTS.md and README
with the expected sections"]:::generated
B --> C3["No command yet: green
until its first code"]:::generated
- B --> C4["CODEOWNERS updated"]:::generated
+ B --> C4["CODEOWNERS updated
unless another agent approves it"]:::generated
B --> C5["Runbook
when criticality is high or critical"]:::generated
B --> C6["Fitness functions and CI
active from the first commit"]:::generated
C3 --> E["The team declares its stack's
check and test, then codes"]:::human
@@ -190,13 +213,15 @@ usefully without a spoken conversation.**
The expected path:
```
-0. read the charter and the current cycle → who it is for, what is being delivered now
+0. read the charter, and of the current cycle its front matter and your deliverable's section
+ → who it is for, what is being delivered now
1. read the module's MANIFEST → what it is for, who owns it, what it consumes
2. read the local AGENTS.md → specific conventions and traps
3. run bootstrap then check → a working environment, validations green
4. read the contracts consumed → what it can rely on
5. read the module's ADRs → why it is the way it is
-6. pick up a Ready issue → scope and criteria already explicit
+6. take a ready deliverable → nstack claim D: scope and criteria already explicit,
+ held so that nobody else delivers it
```
If one of these steps requires asking somebody, that is a defect of the system, not of
@@ -220,7 +245,7 @@ playbooks, runs the verbs and proposes changes, which CI accepts or refuses exac
would from any other contributor.
The OS therefore declares **capabilities**, and a *tooling profile*
-(`docs/tooling-profile.md`) maps them onto the tools of the moment. Changing tool then
+(`.nstack/tooling-profile.md`) maps them onto the tools of the moment. Changing tool then
happens without touching the OS.
| Capability | What it is for |
@@ -230,7 +255,7 @@ happens without touching the OS.
| Access to official sources | Versions, APIs, real constraints |
| Running commands and tests | Making the oracle actually executable |
| Git, issue and pull request interaction | Traceability and small batches |
-| Agent identity | Changes arrive under the agent's own name, behind a human approval |
+| Agent identity | Changes arrive under the agent's own name, behind the approval the project asks for |
| UI inspection and screenshots | UX validation beyond "it compiles" |
| Driving a browser or an emulator | Explored scenarios of a test sheet, with their evidence |
| Security analysis | Integrated automated checks |
@@ -262,7 +287,8 @@ What the skeleton and its engine provide from day one:
another module's data, contract compatibility and consumers, lifecycle statuses and
dates, one pull request one module, the module envelope;
- CI with the checks of the `standard` level;
-- CODEOWNERS, and the checklist of forge settings, which the engine verifies read-only;
+- CODEOWNERS, and the checklist of forge settings, which the engine verifies read-only (`doctor`) and
+ applies under the owner's own credential (`settings --apply`);
- module creation;
- new skeleton versions, offered as a reviewed pull request and merged with the project's
adaptations.
diff --git a/docs/os/10-measurement.md b/.nstack/handbook/10-measurement.md
similarity index 93%
rename from docs/os/10-measurement.md
rename to .nstack/handbook/10-measurement.md
index 5a051c8..df92921 100644
--- a/docs/os/10-measurement.md
+++ b/.nstack/handbook/10-measurement.md
@@ -86,11 +86,12 @@ How many cycles ended at their end date rather than with every deliverable accep
occasional one is healthy: the appetite held. Every one: the appetites or the deliverables
are wrong — frame smaller.
-### Findings beyond the verifier
+### Escaped defects
-On every pull request carrying a test sheet, what the approver found that the verifier had
-missed. It is the measurement that may one day let a verifier agent's approval count,
-module by module (`07-governance.md` §7).
+The share of merged pull requests a defect found within 30 days of their merge names — the bug
+form asks for the pull request that brought it. Read per module, and per answer to who approves
+(`approval: human` or `agent`, `07-governance.md` §7): it is what tells whether an agent's
+approval holds where the project lets it count.
### Overdue contractions
@@ -173,7 +174,7 @@ Three meetings are enough. All of them produce a decision, never a mere observat
| Ritual | Frequency | Content | Output |
|---|---|---|---|
| **Boundary review** | Monthly | Cross-module PRs, fitness function violations, overdue contractions | *Architecture* issues, or nothing |
-| **Decision review** | Quarterly | ADRs/PDRs whose criterion has come due | Confirmed · superseded · feature removed |
+| **Decision review** | At each cycle's closure | ADRs/PDRs whose criterion has come due, as C10 names them | A reading line: met · missed · superseded; a missed one, a decision of its own |
| **Automation backlog review** | Quarterly | Rules still living in the prompt | Automate · remove · renew with a deadline |
The last two can be held together: they address the same subject from two sides — what
diff --git a/.nstack/handbook/INSTALL.md b/.nstack/handbook/INSTALL.md
new file mode 100644
index 0000000..090bbe8
--- /dev/null
+++ b/.nstack/handbook/INSTALL.md
@@ -0,0 +1,469 @@
+# Installing and updating the foundation
+
+> **This project was created by `nstack init`**, the command of the NapkinStack engineering
+> framework. This page is the manual for the foundation: what to install, what to set on the
+> forge, how a new version arrives. The method itself is the rest of `.nstack/handbook/`; the project's
+> own front page is its `README.md`, and nothing here belongs on it.
+
+```mermaid
+flowchart LR
+ I["nstack init
project created and committed"]:::cmd --> G["GitHub repository
checklist applied"]:::team
+ G --> D["nstack doctor
workstation and settings"]:::cmd
+ D --> X["nstack discover idea.md
then the discovery, with your agent"]:::cmd
+ X --> F["Framing with your agent
charter + first cycle"]:::team
+ F --> M["nstack new-module
first module"]:::cmd
+ M --> W["Work in pull requests
CI: fitness, hooks, secrets, sheet, cycle"]:::team
+ W --> U["nstack update
new version, reviewed branch"]:::cmd
+ U --> W
+
+ classDef cmd fill:#1f2937,color:#fff
+ classDef team fill:#065f46,color:#fff
+```
+
+**Legend** — grey: an `nstack` command · green: the work of the team and its agent.
+CI decides as soon as the rulesets require it: what does not pass does not merge (see
+"Prerequisites").
+
+## Prerequisites
+
+- **Workstation**: uv and git; read access to GitHub (the NapkinStack skeleton) and to
+ PyPI.
+- **GitHub repository.** Workflows inform; only rulesets and push protection block. What
+ each case allows:
+
+| Setting | Public repository | Private, Free plan | Private, Team or Pro |
+|---|---|---|---|
+| Rulesets: PR, review, CODEOWNERS, required checks | Yes | **No: nothing blocks the merge** | Yes |
+| Secret scanning and push protection | Yes | No | Paid Secret Protection option |
+| Private vulnerability reporting | Yes | Does not exist | Does not exist |
+| CI minutes | Unlimited | 2 000 per month | Per the plan |
+
+`nstack doctor` reads these settings and answers in one word. **Guarded**: the forge refuses
+what the checklist asks it to refuse. **Unguarded**: nothing here refuses a merge — and it
+keeps apart what your plan forbids, which you can do nothing about, from what is simply not
+in place yet. A project that has done everything its plan allows is reported as compliant,
+and still told that it is unguarded: the checks below keep telling the truth, and none of
+them stops a merge on their own.
+
+Whatever the plan allows, the project receives one more workflow, **Commits on main**: it
+fails when a commit reached `main` outside a pull request, and names it. It records; it does
+not refuse — on a repository where nothing can refuse, it is the only thing that will ever
+mention such a commit, and where a ruleset does refuse, it catches a bypass.
+
+**Where the CI runs.** Every job runs on GitHub's hosted Ubuntu unless the repository
+variable `NSTACK_RUNS_ON` names another runner label — a self-hosted runner, for a private
+repository whose hosted minutes are spent: `gh variable set NSTACK_RUNS_ON --body
+