oficina / equipo Public

spec rev 2: fold in Astra round 1 (15 findings)

Marks are hints, contract v2 inventory and person acceptance, one
idempotent batch, complete CSPs, a separate review page, an iOS gate,
delegation for training and Ask Copy, tombstones, failures and quotas.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
claude agent, operated by paul@keymail.dev pushed by paul@keymail.dev ac48dc62475732ca71bf1a2033ff8fdd740cbe51 parent d6b1efd
1 file changed, +791 −549
  • docs/superpowers/specs/2026-11-30-copy-trainer-and-in-place-review.md +791 −549
diff --git a/docs/superpowers/specs/2026-11-30-copy-trainer-and-in-place-review.md b/docs/superpowers/specs/2026-11-30-copy-trainer-and-in-place-review.md
index 284d87fe..f53da111 100644
--- a/docs/superpowers/specs/2026-11-30-copy-trainer-and-in-place-review.md
+++ b/docs/superpowers/specs/2026-11-30-copy-trainer-and-in-place-review.md
@@ -1,8 +1,11 @@
# Copy training and in-place review
-Status: revision 1, 2026-11-30, drafted by Claude (Opus 5.5) on
-`copy-trainer-spec` from main ea3022bd. Nothing is built. Astra review
-pending. Mockups: section 9.
+Status: revision 2, 2026-11-30, drafted by Claude (Opus 5.5) on
+`copy-trainer-spec` from main ea3022bd. Nothing is built.
+- Astra round 1: NOT READY, with 15 findings (7 P1). All were taken; the
+ list is in section F.
+
+Mockups: section 9.
Paul, 2026-11-30: "I'd also love there to be a copy review tool within
Equipo that does something that one of the sessions on here discussed but
@@ -19,78 +22,109 @@ Two features:
- **A. Copy training.** Opt-in drills on the person's real strings. Each
answer becomes one of their Copy notes.
- **B. In-place review.** On a task's preview, the person edits text where
- it sits, or comments on any element. Copy or Design changes the task's
- branch, and the page refreshes.
+ it sits, or comments on any element. The change lands on the task's
+ branch and the page refreshes.
## 0. What exists today
- **Copy** (spec 2026-11-13) runs only on projects where an owner turned on
- "Copy can accept on my behalf". In contract mode (`.equipo/copy.json`) it
- reviews changed strings in one structured call, and the runner applies
- and accepts them through base-pinned scripts. Generic mode only flags.
-- **What teaches Copy.** Only the delegating owner's own edits on a task
- card (`EditCopyWording`, `copy_edit.go`) and imported copy-review results
- (`ImportCopyReview`). Both write `copy_feedback` rows (project, owner,
- key, before, after, reason). `copyNotes` feeds Copy at most 40 of them,
- 6 KiB. No page shows or forgets them; that UI was deferred. Forge diffs
- never teach.
+ "Copy can accept on my behalf". Without that delegation, no Copy model
+ call runs at all, not even a proposal or a learning call.
+ - In contract mode (`.equipo/copy.json`), Copy reviews changed strings in
+ one structured call. The runner applies them through base-pinned
+ scripts, then accepts them.
+ - Generic mode only flags.
+ - The contract's `extract` compares two trees (base and candidate) and
+ returns what changed. No operation lists every string at one commit.
+ - `ValidateReview` keeps placeholders in the same order.
+ - `copy-contract.py accept` needs a delegation revision, and it always
+ writes the delegated-Copy marker.
+- **What teaches Copy.** Only the delegating owner, through two paths: their
+ own edits on a task card (`EditCopyWording`, which refuses unless the
+ task's latest step has finished), and copy-review results they import.
+ - Both paths write `copy_feedback` rows: project, owner, key, before,
+ after, reason. `CanLearn` limits a row to 400 bytes in all.
+ - The import's dedupe identity lives in the row itself.
+ - `copyNotes` feeds Copy at most 40 rows (6 KiB). It promotes a pending
+ row only while housekeeping's budget allows.
+ - Nothing shows these rows or lets the person forget them.
+ - Forge diffs never teach.
- **Design's taste notes** (dynamic specialists 8.6, on branch
- `design-feedback-1`, not built). The spec defines `chat_taste_notes`
- (person, discipline, project or "" for all, source `words` or `choice`),
- a notebook revision bumped by every write and forget, and a page that
- leads with "Design knows N things about your taste" and offers Forget,
- Forget everything and Add a note.
-- **The preview wrapper** (`preview_wrapper.go`). `/tasks/{id}/preview`
- frames the deployed preview (a devbox share, or a public temporary place)
- from its own origin: `sandbox="allow-scripts allow-same-origin"`, and a
- wrapper CSP of `default-src 'none'; frame-src <preview origin>`. The
- wrapper runs no script. The preview is cross-origin, so nothing in the
- wrapper can read or touch it. Previews deploy after Review.
+ `design-feedback-1`, not built).
+ - Storage: `chat_taste_notes` (person, discipline, project or "" for all,
+ source `words` or `choice`), and a notebook revision that every write
+ and forget bumps.
+ - A page that leads with "Design knows N things about your taste", with
+ Forget, Forget everything and Add a note.
+ - The rule from section 2: model origin is never erased. When a person
+ edits model text, the edit is kept beside the original.
+- **The preview wrapper.** `/tasks/{id}/preview` frames the deployed
+ preview, which lives on another origin (a devbox share or a public
+ temporary place). The wrapper runs no script.
+ - Its CSP is `default-src 'none'; frame-src <preview origin>`.
+ - `validatePreview` returns 404 unless the deployed preview is of the
+ task's current candidate.
+ - Previews deploy after Review.
- **The renderer** (dynamic specialists section 3, live since 27d50e7f).
- A pinned headless Chromium on Linux runners, in a sandbox with no
- network, renders a static tree (the base or a workspace snapshot).
- Rendering a running app (`.equipo/render.json`) is slice 3 of that spec
- and is not built.
-- **The copy-review skill** on docs-t1 (agent-skills). Agents put strings
- in `strings.json`, build a scriptless preview with `data-copy` bindings,
- and Paul edits in place beside the page. Inline Reroll asks a sandboxed
- drafter for a fresh take. The result's hand edits are the taste signal.
- The preview is same-origin with the review page, so the page's own
- controller can reach into it. The preview runs nothing because of its
- CSP, `script-src 'none'`.
+ It runs on Linux runners: a pinned headless Chromium, sandboxed with no
+ network. It renders a static tree (the base or a workspace snapshot).
+ Rendering a running app (`.equipo/render.json`) is that spec's slice 3
+ and isn't built.
+- **The copy-review skill** on docs-t1 (agent-skills).
+ - Strings live in `strings.json`, with a scriptless preview that carries
+ `data-copy` bindings.
+ - Paul edits in place, beside the page. Reroll asks a sandboxed drafter
+ for a fresh take.
+ - The preview is same-origin, framed `sandbox="allow-same-origin
+ allow-scripts"`. Its CSP, `script-src 'none'`, stops it running
+ anything. `allow-scripts` is there only because iOS Safari won't
+ deliver events into a sandboxed frame without it.
+ - `html-tokens.mjs` maps HTML text to byte offsets in the source file.
- **The rail.** Copy has a sidebar row and a page (`/team/copy`). Needs you
- holds only work that is waiting on the person.
+ is only for work that waits on the person.
## A. Copy training
### A1. Who, and turning it on
-Training is for owners in v1, because Copy only ever works for an owner
-(question 1). On Copy's page, an owner sees a **Train Copy** block with
-**Start** (5 drills) and a switch, **Offer me drills**.
+Copy runs only where an owner has delegated to it, so training does too.
+An owner can train Copy on the projects where they are the delegating
+owner. Anyone else sees, on Copy's page, "Copy trains on projects where it
+accepts wording for you", and nothing more.
+
+Copy's page has a **Train Copy** block with two controls:
+- **Start** prepares 5 drills on the person's tap and opens them. It works
+ any time. Opting in at any moment is this button.
+- **Offer me drills** is a switch, off by default. With it on, Equipo
+ prepares one session a day and shows it on Copy's sidebar row (A4).
+
+**Stopping.** Turning the switch off deletes any prepared session that
+hasn't started. A started session can be finished or left. Notes stay until
+the person forgets them.
+
+The switch is stored per person, with a revision.
-- **Start** works any time, with the switch on or off. Opting in at any
- moment is this button.
-- **Offer me drills** (off by default) lets Equipo prepare one session a
- day and show it on Copy's sidebar row (A4).
-- **Stop** is the same switch. Turning it off deletes any prepared session
- that hasn't started, so it costs nothing more. A session already started
- can be finished or left. Notes stay until the person forgets them.
+**Losing the grant.** A session is bound to its project's delegation
+revision. Any of these withdraws the project's unstarted and unfinished
+sessions, and their remaining drills refuse answers:
+- turning delegation off;
+- a new delegating owner;
+- the person's removal, or a role change away from owner.
-The switch is per person and stored with a revision, like Copy's
-delegation. Removing a member, or changing their role away from owner,
-stops their offers and their sessions at once, and their notes stop
-reaching Copy.
+Notes already written stay theirs. They reach Copy only where Copy runs for
+them.
### A2. The drills
-A session is 5 drills: 3 picks and 2 rewrites, about two minutes. Each
-drill shows the string's project, where it appears, and a capture of that
-spot when one exists (B makes these; A works without them).
+A session is 5 drills, 3 picks and 2 rewrites, and takes about two
+minutes. Each drill shows:
+- the string's project;
+- where it appears;
+- a capture of that spot, when B has made one. A works without captures.
**Pick the best phrasing.** Two to four phrasings, which differ on one
-**axis** only. Equipo's list of axes is fixed in code, so the model can't
-invent one:
+**axis** only. Equipo fixes the axes in code, so the model can't invent
+one:
| Axis | What changes |
|---|---|
@@ -103,608 +137,816 @@ invent one:
| Label form | Verb first ("Save changes") vs noun ("Changes") |
| Sentence form | Fragment vs full sentence, with or without a full stop |
-One of the options is the app's current wording. Which one stays hidden
-until the pick (question 5). Copy writes the others in the prep call (A3),
-placed along the axis, such as shortest to longest. The instance checks what
-it can check: options are distinct; placeholders are the same multiset as
-the current string; each option fits the string's length limit when the
-contract gives one; the project's house rules hold where they can be checked
-mechanically (no em dashes and no exclamation marks for Equipo). For
-Length, word counts must rise in order. Any other axis is Copy's claim and
-is labelled as Copy's.
-
-The person taps one option, or **None of these** to open a box and write
-their own. **Skip** records nothing. After the pick, the drill reveals two
-things:
-
-- which option the app uses now;
-- whether Copy guessed the pick. Copy records its guess in the prep call,
- before the person sees the drill, and it is never shown in advance.
-
-**Rewrite this.** The current string, its context, its placeholders as
-locked chips, and a box. Three ways to answer:
-
-- **Use mine** saves the typed text, with an optional "Why" line;
-- **It's fine as is** records that they kept it;
+One option is the app's current wording. Which one stays hidden until after
+the pick (question 4). Copy writes the others in the prep call (A3), placed
+along the axis, for example shortest to longest.
+
+**Checks.** The instance checks what it can:
+- the options are all different;
+- each option has the current string's placeholders, in the same order;
+- each option fits the string's length limit, when the contract gives one;
+- the project's mechanical house rules hold (for Equipo: no em dashes and
+ no exclamation marks);
+- for Length, word counts rise in order.
+
+Any other axis is Copy's claim, and the drill labels it as Copy's.
+
+**Answering a pick.**
+- Tap one option.
+- **None of these** opens an empty box for the person to write their own.
- **Skip** records nothing.
-**Neither kind of drill changes the repository.** Changing a string found
-in a drill comes later, from the apply path that B builds (question 6).
+After the pick, the drill shows which option the app uses now. It also
+says whether Copy guessed the pick. Copy records its guess in the prep
+call, before the person sees the drill, and never shows it in advance.
-### A3. Where drills come from
+**Rewrite this.** The drill shows the current string and its context, with
+its placeholders as locked chips in their order, and a box that starts with
+the current text. Three answers:
+- **Use mine** saves the edited text, with an optional "Why" line;
+- **It's fine as is** records that the person kept it;
+- **Skip** records nothing.
-Drill strings come from the person's own projects, and only from projects
-with a copy contract in v1. Generic extraction picks up technical strings,
-which Paul has asked not to review (question 7).
+**No drill changes the repository.** Changing a string found in a drill
+comes later, through B's apply path (question 5).
-A **drill prep job** runs on the project's primary runner, the same way as
-Copy's other runner work:
+### A3. Where drills come from
-1. It runs the contract's `extract` at the default branch's tip, using the
- contract and scripts as they are at that commit. It applies the same
- containment, input and output bounds, and timeout as a Copy pass.
-2. It picks candidate strings deterministically, from the extracted ones
- and the instance's exclusion list:
- - **Excluded:** strings that are pending in an open task; strings whose
+Drills come from the person's delegated projects, and only from projects
+with a copy contract that supports `inventory` (below). Generic extraction
+picks up technical strings, which Paul has asked not to review
+(question 6).
+
+**A new contract operation, `inventory`.** It lists every string at one
+commit; today's `extract` lists only changes. Contract version 2 adds it as
+an optional command.
+- Input: `{"version":1,"tree":<path>}`.
+- Output: `{"version":1,"strings":[{"key","path","start","end","text","placeholders","context","kind"}]}`.
+ `kind` is one of button, heading, body, error, empty, label, help,
+ string.
+- Limits: at most 5,000 strings and 2 MiB of output. Strings over the
+ limit are dropped, and the output says how many.
+- Keys must be unique.
+
+It runs with the containment, bounds and timeout of `extract`. The
+contract and its scripts come from the commit being listed, and that is
+always the default branch's tip: a reviewed and merged revision. For
+Equipo, `copy-contract.py inventory` reuses `entries()`. It sets `kind`
+from the key's prefix, and `context` from the comment after the copy.go
+marker.
+
+**A drill prep job** runs on the project's primary runner:
+
+1. **List.** It runs `inventory` at the tip of the default branch.
+2. **Choose.** It picks candidate strings deterministically, using the
+ instance's exclusion list.
+ - Excluded: strings that are pending in an open task; strings whose
current text came from this person's own edit or import; strings
drilled for this person in the last 90 days; strings under 2 or over
300 bytes; strings that are only placeholders.
- - **Preferred, in order:** strings that changed on the default branch in
- the last 30 days; strings Copy flagged as "Wording to check"; then a
- spread across kinds (button, heading, error, empty state, help), using
- the contract's optional `kind`.
-3. It makes one structured model call, in Copy's empty model workspace,
- that writes the phrasings, the axis and the guess for the 3 pick drills.
- It also writes a one-line "where it appears" for any string whose
- contract context is only its key (true of Equipo today).
- - **Inputs:** the strings, quoted as repository content; the house
- rules section of AGENTS.md from that commit; and the person's current
- Copy notes (A5), so that the drills probe what Copy doesn't know yet.
- - **Output:** `{"version":1,"drills":[{"key","axis","options":[...],"current":i,"guess":j,"where"}]}`.
- Everything the model writes is stored as Copy's words.
- - **Validation:** the runner and the instance both check the output
- strictly (A2). A drill that fails is dropped. A session needs at least
- 4 valid drills; with fewer, the session is not offered and the error is
- kept on the job.
-4. The instance stores the session for that person, bound to the project,
- the commit and the job.
-
-**Cost.** The prep call runs on the person's own connections and shows in
-Usage as "Copy training". It uses Copy's model ceiling (cheap or standard,
-no fallback above it) and is limited to 16,384 tokens per call, 4 calls per
-person per day. It does not use the housekeeping ledger, so training never
-competes with Copy's repairs. Offers prepare at most one session a day.
-**Another 5** prepares another on the person's tap, up to the daily cap.
+ - Preferred, in order: strings that changed on the default branch in
+ the last 30 days; then strings Copy flagged as "Wording to check";
+ then a spread across kinds.
+3. **Write.** It makes one structured model call, in Copy's empty model
+ workspace, which writes the phrasings, the axis and the guess for the 3
+ picks. The same call writes a one-line "where it appears" for any string
+ whose context is only its key.
+ - The call is given three things: the strings, quoted as repository
+ content; the house rules section of AGENTS.md at that commit; and the
+ person's current Copy notes (A6), so the drills probe what Copy
+ doesn't know yet.
+ - Output: `{"version":1,"drills":[{"key","axis","options":[...],"current":i,"guess":j,"where"}]}`.
+ - Everything the model writes is stored as Copy's words.
+4. **Check.** The runner, and then the instance, check the output strictly
+ against A2. A drill that fails is dropped.
+5. **Store.** A session needs at least 4 valid drills. The instance stores
+ it for that person, bound to the project, the commit, the delegation
+ revision and the job.
+
+**Cost.** The prep call runs on the person's own connections, and Usage
+shows it as "Copy training".
+- Model: Copy's ceiling, cheap or standard, with no fallback above it.
+- Per call: at most 16,384 tokens and 2 minutes.
+- Per person: at most 4 calls a day, and one in flight.
+
+It doesn't use the housekeeping ledger, so training never competes with
+Copy's repairs. Offers prepare at most one session a day; **Start** and
+**Another 5** each prepare one on the person's tap, within the daily cap.
+
+**Failure.** A prep job that fails, or that yields fewer than 4 drills,
+shows on Copy's page as "Couldn't prepare drills", with a reason and **Try
+again**. A retry counts against the daily cap. After 2 failures in a day,
+offers stop until the next day.
### A4. When drills are offered
Drills never appear in Needs you, notifications, push, email or the
-conversation. Needs you is for work that is waiting on the person, and a
-drill never is.
-
-- **With Offer me drills on** and a session ready, Copy's sidebar row
- shows "5 drills" in place of "idle" while Copy is idle. Copy's page leads
- with the Train block. That is the whole offer.
-- **Backing off.** If three offered sessions in a row expire unstarted
- (each lasts 3 days), offers pause for 14 days, and Copy's page says so.
- Start still works.
-- **Asking for it.** When the person asks the coordinator to train Copy,
- it answers with a link to Copy's page. No new tool is needed.
+conversation. Needs you is for work that waits on the person, and a drill
+never does.
+
+With **Offer me drills** on and a session ready, two things change while
+Copy is idle:
+- Copy's sidebar row shows "5 drills" in place of "idle";
+- Copy's page leads with the Train block.
+
+That is the whole offer.
+
+**Backing off.** An offered session expires after 3 days. If three in a row
+expire unstarted, offers pause for 14 days and Copy's page says so. Start
+still works while offers are paused.
+
+**Asking.** When the person asks the coordinator to train Copy, it replies
+with a link to Copy's page. No new tool is needed.
### A5. What an answer records
-Answers use the evidence classes that already exist (AGENTS.md: model text
-is never the person's words; a tapped option is a choice among model text).
+The evidence classes are AGENTS.md's:
+- model text is never the person's words;
+- a tapped option is a choice among model text;
+- model origin is never erased (dynamic specialists section 2).
| Answer | Stored as | Default scope |
|---|---|---|
-| Use mine / None of these + text | **Their words**: a `copy_feedback` row, origin `training`, before = current text at the drill's commit, after = typed text, reason = Why | The drill's project |
-| Pick | **Their choice**: a `chat_taste_notes` row, discipline `copy`, source `choice`: the axis (Equipo's words), each option (Copy's words, or "the app's wording" for the current one), the chosen index | All their projects |
-| It's fine as is | **Their choice**: kept the current wording, quoted as the app's wording | The drill's project |
-| None of these | Also a choice: rejected Copy's options | All their projects |
+| Use mine | **Their words**: a `copy_feedback` row, origin `training`: before = the current text at the drill's commit, after = their text, reason = Why | The drill's project |
+| None of these, then their own text | **Their words** (the box starts empty), plus a choice: they turned down Copy's options | Words: the project. Choice: all their projects |
+| Pick | **Their choice**: a `chat_taste_notes` row, discipline `copy`, source `choice`, holding the axis (Equipo's words), each option (Copy's words, or the app's wording for the current one) and the index they chose | All their projects |
+| It's fine as is | **Their choice**: they kept the app's wording | The drill's project |
| Add a note (Copy's page) | **Their words**: a `chat_taste_notes` row, source `words` | Their pick |
-The rules:
-
-- **Answers are the person's.** An answer is written in the transaction of
- the person's authenticated tap. The actor comes from the session. The
- drill must belong to that person and be unanswered, and the roster and
+**Writing an answer.**
+- **One transaction.** Each answer is written in the same transaction as
+ the person's authenticated tap.
+- **Actor.** The actor comes from the session, never from the form.
+- **Fresh checks.** The drill must be theirs and unanswered, and the
+ session's delegation revision must still be current. The roster and the
owner role are checked again in that transaction.
-- **A second tap is a no-op.** The answer's identity is the drill id.
-- **Rewrites skip delegation.** Training rows don't need delegation on
- their project (today's `CanLearn` requires it for task edits), because
- they are the person's notes, not Copy's work. They reach Copy only where
- Copy runs for that person (A6).
-- **Bounds.** Typed text is at most 300 bytes, Why at most 200, and a note
- at most 300.
-- **Audit.** Each answer appends an audit row with the actor, drill id and
- answer kind, never the text.
-
-A rewrite is project-scoped because wording belongs to its product. Picks
-are about taste, which travels (question 3).
+- **One answer per drill.** The drill id is the answer's identity, so a
+ second tap does nothing.
-### A6. How training changes Copy
+**Size limits per origin.** These replace `CanLearn`'s single 400-byte
+limit for the new origins only; `equipo` and `copy-review` rows keep 400.
+- `training` and `in-place`: before 300, after 300, reason 200 bytes.
+- A note's body: 300 bytes.
-**What Copy proposes.** Every Copy pass on a project includes the
-delegating owner's notes, each quoted under a label naming its source
-(AGENTS.md rule 3): "Paul's own words, typed in a drill on 30 Nov" or
-"Paul's choice among phrasings Copy wrote, differing in length". The notes
-are ordered this project's first, then all projects, newest first:
+**Learning.** New rows are pending, exactly like task-card edits.
+`copyNotes` promotes them under the same housekeeping rule. Copy's page
+counts only learned notes, and says "4 waiting while housekeeping is
+paused" when some are pending.
-- words, meaning edits, imports, rewrites and typed notes: at most 40 and
- 6 KiB, as today;
-- choices: at most 20 and 2 KiB, each rendered as "chose A over B and C
- (axis)";
-- typed rules from Add a note: at most 10 and 1 KiB.
+**Audit.** Every answer adds an audit row: the actor, the drill id and the
+kind of answer. The text is never in it.
-That is 9 KiB in all, under the 12 KiB notebook ceiling. The plan
-re-measures the Copy baseline fixture with a full notebook against the
-32,768-token pass limit. If it doesn't fit, the oldest choices are dropped
-first.
+**Default scope.** A rewrite belongs to its own project, because wording
+belongs to its product. A pick reflects taste, which travels, so it covers
+all the person's projects (question 3).
-**Precedence, stated in the prompt.**
+### A6. How training changes Copy
-1. The project's house rules at the trusted base;
+**What Copy proposes.** Each Copy pass carries the delegating owner's
+notes. Each note is quoted under a label naming its source (AGENTS.md rule
+3), for example "Paul's own words, typed in a drill on 30 Nov", or "Paul's
+choice among phrasings Copy wrote, differing in length".
+
+The notes go in this order: this project's first, then all projects; within
+each, newest first. Each class has its own cap:
+- **Words** (edits, imports, rewrites and in-place edits): 40 notes, 6 KiB,
+ as today.
+- **Edited suggestions** (B4): 10 notes, 1.5 KiB, shown as "Paul changed
+ Copy's X to Y".
+- **Choices**: 20 notes, 2 KiB, shown as "chose A over B and C (axis)".
+- **Typed rules** from Add a note: 10 notes, 1 KiB.
+
+That comes to 10.5 KiB, under the 12 KiB notebook ceiling. The plan
+re-measures Copy's baseline fixture with a full notebook against the
+32,768-token pass limit. If it doesn't fit, the oldest choices are dropped
+first, then edited suggestions.
+
+**Precedence, stated in the prompt:**
+1. the house rules at the trusted base;
2. the owner's explicit instruction on the current task;
3. their words;
-4. their choices;
-5. Copy's defaults.
+4. their edited suggestions;
+5. their choices;
+6. Copy's defaults.
-Within a class, newer wins. When Copy goes against a note, it says so in
-the string's flag.
+Within a class, the newer note wins. When Copy goes against a note, it says
+so in that string's flag.
-**What Copy accepts.** Training does not change Copy's authority. Notes
-never grant, widen or skip acceptance. Copy accepts only with delegation,
-a matching server record and the exact text hash. Notes never override
-placeholders, the owner's exact wording on a task, or house rules. Copy
-may flag fewer strings once it knows the person, but no rule depends on
-that.
+**What Copy accepts.** Training doesn't change Copy's authority.
+- Notes never grant, widen or skip acceptance.
+- Copy accepts only with delegation, a matching server record and the exact
+ text hash.
+- Notes never override placeholders, the owner's exact wording on a task,
+ or the house rules.
-**How well Copy knows you.** Copy's page shows how often Copy guessed the
-person's pick in their last 20 picks ("Copy guessed 14 of your last 20
-picks"). Equipo counts it from records, so it is a measure, not a claim.
-It is shown for information only in v1 (question 2).
+**How well Copy knows you.** Copy's page shows how many of the person's
+last 20 picks Copy guessed: "Copy guessed 14 of your last 20 picks".
+Equipo counts this from its records. It's for information only in v1
+(question 2).
### A7. Seeing, correcting, forgetting
-Copy's page shares the taste-notes page with Design (8.6). One template
-partial, `taste_notes`, takes a discipline. Whichever spec builds first
-builds `chat_taste_notes` and the partial; this one adds discipline `copy`.
+Copy's page shares the taste-notes page with Design (8.6), through one
+template partial, `taste_notes`, that takes a discipline. Whichever spec is
+built first builds `chat_taste_notes` and the partial. This one adds the
+`copy` discipline.
- **State first.** The page leads with "Copy knows 34 things about your
- writing". Under it are chips counting each source (Your edits, Your
- picks, Your rewrites, Your notes, Imported) and the guess rate.
-- **The notes.** Each row shows its source chip, its text, its project or
- "All projects", its date, and **Forget**. Words show as before → after.
- Picks show the chosen phrasing with the others struck through, and the
- axis. Filtering by source uses the chips. **Forget everything** clears
- the Copy notebook, and **Add a note** writes a rule.
-- **Copy's existing rows** (task edits and imports) appear here too, and
- become forgettable for the first time.
-- **Forgetting** deletes the row and bumps the person's Copy notebook
- revision. A Copy dispatch records the revision it used. The start
- authorization refuses a stale one and dispatches again with a rebuilt
- brief, as 8.6 does for Design. Copy is a structured call with no saved
- session, so there is no resume to fence.
-- **Audit.** Each forget appends an audit row with the actor, note id and
- source kind.
-- **Privacy.** Only the person sees their notes.
+ writing". Below that, chips count each source: Your edits, Your
+ rewrites, Your picks, Your notes, Imported. The guess rate comes next.
+- **Each note** shows its source, its text, its project (or "All
+ projects"), its date, and **Forget**.
+ - Words show before → after.
+ - Picks show the chosen phrasing, the others struck through, and the
+ axis.
+ - The chips filter the list by source.
+- **Whole notebook.** **Forget everything** clears it. **Add a note** writes
+ a rule.
+- **Older notes.** Copy's existing rows (task edits and imports) appear
+ here too, and can be forgotten for the first time.
+
+**Forgetting a note** does four things:
+- it deletes the row;
+- it writes a tombstone (`copy_forgotten`: person, project, source
+ identity, no text), so importing the same result again skips that
+ source, and the import says how many it skipped;
+- it bumps the person's Copy notebook revision;
+- it adds an audit row: actor, note id, kind of source.
+
+**The revision fence.** Each Copy dispatch records the notebook revision it
+used. The start authorization refuses a stale revision and dispatches
+again with a rebuilt brief, as 8.6 does for Design.
+
+Only the person sees their own notes.
### A8. Wire and storage (A)
-- **Protocol.** The next free protocol (40 if `design-feedback-1` lands
- first) adds the drill prep job. A runner below it never gets one. The job
- binds person, project, commit, the training switch's revision and the
- notebook revision. The instance refuses a job result whose bindings have
- moved.
-- **Migrations, additive:**
- - `copy_training` (person, offers on, revision, paused until);
- - `copy_drill_sessions` (id, person, project, commit, job, state, created,
- expires);
- - `copy_drills` (session, index, kind, key, current text, where, axis,
- options, current index, guess, answer kind, answer, answered at);
- - `chat_taste_notes` gains discipline `copy` (or is created here);
- - a Copy notebook revision per person;
- - the `copy_feedback` origin `training`.
-- **Contract.** The contract's `extract` output gains an optional `kind`
- for each string. Equipo's `copy-contract.py` sets it from the key prefix
- and the comment after the copy.go marker.
+**Protocol.** The next free protocol (40 if `design-feedback-1` lands
+first) adds the drill prep job and the `inventory` operation.
+- A runner below that protocol never gets either.
+- The job binds the person, project, commit, the switch's revision, the
+ delegation revision and the notebook revision.
+- The instance refuses a result whose bindings have moved.
+
+**Migrations, all additive:**
+- `copy_training`: person, offers on, revision, paused until;
+- `copy_drill_sessions`: id, person, project, commit, delegation revision,
+ job, state, created, expires;
+- `copy_drills`: session, index, kind, key, current text, where, axis,
+ options, current index, guess, answer kind, answer, answered at;
+- `copy_forgotten`;
+- the `copy` discipline on `chat_taste_notes` (or the table itself, if 8.6
+ hasn't built it yet);
+- a Copy notebook revision per person;
+- the `training` and `in-place` origins on `copy_feedback`.
## B. In-place review
### B1. What the person sees
-The preview wrapper gains a three-way switch above the frame: **Live**,
-**Edit text**, **Comment**.
-
-- **Live** is today's frame.
-- **Edit text** and **Comment** show a **review copy** of one page (B2),
- with a page picker and a viewport picker (phone, tablet, desktop).
- - **Pages.** The picker lists the preview's pages: the HTML files in the
- exported preview, and the pages `.equipo/render.json` names once
- running-app renders exist. Opening from a Design option's Open live
- starts on that option's page.
- - **Editing.** Every piece of text that maps to a source string (B3) gets
- a faint outline. Tapping one opens the editor: a side panel on desktop,
- a bottom sheet on a phone, laid out like the copy-review skill's. The
- page updates as the person types. Changes collect in a tray ("3
- changes") with **Apply**. The tray autosaves on the instance, so a
- reload or a move to another device loses nothing.
- - **Commenting.** Tapping any element, or dragging a box, pins a comment.
- Comments collect in the same tray with **Send**.
- - **Refresh.** After Apply or Send, the tray shows each item's progress.
- The review copy refreshes when the branch has the change (B5).
-
-Only the task's creator gets Edit text and Comment in v1. Everyone else who
-can see the task sees Live and nothing more. A preview opened through a
-preview pass (the cookie grant) is Live only.
+A new page, `/tasks/{id}/review`, has a three-way switch: **Live**, **Edit
+text** and **Comment**. The existing `/tasks/{id}/preview` doesn't change.
+It keeps its rules for passes and for deployment validity, and it gains a
+link to the review page.
+
+**Live** frames the deployed preview only while `validatePreview` passes
+for the current candidate. Otherwise the page stays open, with the tray,
+and Live says "Live is behind: it updates after review".
+
+**Edit text** and **Comment** work on a **review copy** of one page (B2).
+- **Page and viewport pickers.** The viewport is phone, tablet or desktop.
+ The page list holds the HTML files in the candidate's exported preview,
+ plus, once running-app renders exist, the pages that
+ `.equipo/render.json` names. Arriving from a Design option's Open live
+ starts on that option's page.
+- **Editing text.** Text that maps to a source string (B3) gets a faint
+ outline. Tapping it opens the editor: a side panel on desktop, a bottom
+ sheet on a phone, laid out like the copy-review skill's editor. The page
+ updates as the person types.
+- **Commenting.** Tapping any element, or dragging a box, pins a comment.
+- **The tray.** Edits and comments collect in a tray, with **Apply** for
+ edits and **Send** for comments. The tray autosaves on the instance with
+ a generation number, so a reload or a move to another device loses
+ nothing.
+
+**Who.** Only the task's creator gets Edit text and Comment in v1. Other
+members who can see the task get Live. A preview pass never reaches this
+page.
### B2. Why a review copy, and how it is made
**Why not the live frame.** The live preview runs on another origin, so the
-wrapper cannot see its text or where the person tapped. Getting at it would
-mean running Equipo code inside the preview: an injected script, or a
-bridge that talks to the wrapper with `postMessage`. Either way untrusted
-content gets to tell the wrapper which string an element is, and to watch
-what the person types. So the overlay never touches the live preview.
-
-**The review copy** is a frozen, scriptless copy of one page, made by the
-runner's renderer from the task's current candidate and served from
-Equipo's own origin. It works the way the copy-review skill's preview does,
-with stronger walls.
-
-1. **Request.** The person taps Edit text or Comment, picks a page and a
- viewport, and the instance asks the task's primary runner for a review
- copy (a runner job, not a model step).
-2. **Render.** The runner renders the page with `render_page`'s rules (the
- candidate tree, the renderer sandbox with no network, gitleaks before
- any render), then serialises the loaded document:
- - scripts, frames, objects, embeds, `base`, refresh tags and every `on*`
- attribute are removed;
+wrapper can't see its text or where the person tapped. Reaching it would
+take Equipo code running inside the preview: an injected script, or a
+`postMessage` bridge. Either way, untrusted content would tell the wrapper
+which string an element is, and would see what the person types. So the
+overlay never touches the live preview.
+
+**A review copy** is a frozen, scriptless copy of one page. The runner's
+renderer makes it from the task's current candidate, and Equipo serves it
+from its own origin.
+
+1. **Request.** The person taps Edit text or Comment and picks a page and a
+ viewport. The instance asks the task's primary runner for a review copy.
+ This is a runner job, not a model step.
+2. **Render.** The runner renders the page under `render_page`'s rules: the
+ candidate tree, the renderer sandbox with no network, and gitleaks
+ before any render. Then it serialises the loaded document:
+ - it removes scripts, frames, objects, embeds, `base`, meta refresh and
+ every `on*` attribute;
- links keep their text but lose `href`;
- - forms lose `action`;
- - every stylesheet, font and image is inlined as a `data:` URL, up to
- 4 MiB for the whole copy. An image over that limit becomes an empty
- box of the same size.
-
- It also returns the **text map**: an Equipo id on each text-bearing
- element or attribute (`alt`, `placeholder`, `title`, `aria-label`, a
- button's `value`), with the text and its mapping (B3). It returns a
- capture of the page too.
+ - forms lose `action`, and their controls are disabled;
+ - stylesheets become inline `<style>` blocks, with `@import` resolved;
+ - fonts and images become `data:` URLs, inside CSS too;
+ - the whole copy is at most 4 MiB. An image that would push it over
+ becomes an empty box of the same size.
+
+ The runner also returns the **text map**. Each text-bearing element or
+ attribute (`alt`, `placeholder`, `title`, `aria-label`, a button's
+ `value`) gets an Equipo id, its text, and any mapping evidence (B3).
+ A capture of the page comes back too.
3. **Check.** The instance parses the copy again with an allowlist
- sanitiser in Go. It keeps only known elements and attributes, accepts
- only `data:` URLs (including in CSS and `srcset`), and enforces the
- size limits. Anything it can't parse is refused, never passed through.
- It stores the copy as a task file, bound to task, candidate, attempt,
- page and viewport.
-4. **Serve.** `GET /tasks/{id}/review/{copy}` sends the copy with this CSP:
+ sanitiser written in Go:
+ - only known elements and attributes stay;
+ - the only URLs allowed are `data:` URLs for images and fonts, in
+ attributes and in CSS (`url()`, `image-set`, `srcset`);
+ - the size limits hold.
+
+ Anything the sanitiser can't parse is refused, never passed through.
+ The instance stores the copy as a task file, bound to the task,
+ candidate, attempt, page and viewport.
+4. **Serve.** `GET /tasks/{id}/review/copy/{copy}` sends:
`default-src 'none'; img-src data:; font-src data:; style-src
'unsafe-inline'; script-src 'none'; form-action 'none'; base-uri 'none';
- frame-ancestors 'self'; sandbox allow-same-origin`. It also sends
- `nosniff` and `no-store`. It is readable only by members who can see the
- task, through a signed-in session.
-5. **Overlay.** The wrapper's new script, `review-overlay.js`, is an Equipo
- static file under the wrapper's CSP (`script-src 'self'`). It frames the
- copy as `sandbox="allow-same-origin"`. Because the copy is same-origin
- and runs nothing, the overlay can reach into it to:
+ frame-ancestors 'self'; sandbox allow-same-origin`, with `nosniff`,
+ `no-store` and `Referrer-Policy: no-referrer`. It is readable only by
+ members who can see the task, through a signed-in session.
+5. **The review page's CSP.** `default-src 'none'; script-src 'self';
+ style-src 'self'; font-src 'self'; img-src 'self' data:; connect-src
+ 'self'; frame-src <origin>/tasks/{id}/review/copy/ <preview origin>;
+ base-uri 'none'; form-action 'self'; frame-ancestors 'self'`.
+6. **The overlay.** `review-overlay.js` is an Equipo static file. It frames
+ the copy as `sandbox="allow-same-origin"`. The copy is same-origin and
+ runs nothing, so the overlay can reach into it to:
- draw outlines;
- - keep it inert (no navigation, and Enter and Space don't trigger
- anything);
- - select text, and show the edit as it is typed.
-
- This is the copy-review controller, ported. copy-review found that iOS
- Safari won't deliver events into a same-origin sandboxed frame without
- `allow-scripts`. The plan proves the combination with the WebKit tests;
- whichever one it needs, `script-src 'none'` and the response's CSP
- sandbox keep scripts off.
-
-The review copy is a snapshot. Menus, hovers and states that need script
-don't appear in it. The live tab still has them, and Comment on Live
-(question 8) is later work.
+ - keep the copy inert: no navigation, and Enter and Space activate
+ nothing;
+ - select text, and show the person's edit as they type.
+
+ This is the copy-review controller, ported. If the frame ever leaves
+ `/tasks/{id}/review/copy/`, the overlay detaches and loads the copy
+ again, a bounded number of times.
+
+**A gate before B1 is built: iOS events.** copy-review found that iOS
+Safari won't deliver events into a same-origin sandboxed frame unless the
+sandbox allows scripts. A CSP `sandbox` directive adds its own flags, so a
+frame attribute alone can't lift that.
+
+The plan's first task is a WebKit test under the exact headers above. It
+proves two things:
+- taps and keys reach the overlay;
+- a planted `<script>`, an inline handler, a `javascript:` link and a
+ `data:` script all stay inert.
+
+If the test fails, the fallback is copy-review's own tested arrangement.
+Both the frame and the response's CSP `sandbox` gain `allow-scripts`.
+Scripts stay off because of `script-src 'none'` and the sanitiser, and the
+same test has to pass again. No other arrangement may be used, and B1
+isn't built until one of these two passes.
+
+**A snapshot has limits.** Menus, hovers and states that need script don't
+exist in a review copy. Live still has them. Commenting on Live is later
+work (question 7).
### B3. From an element to its source string
-Each element in the text map gets one of four mappings. The editor shows
-which one applies.
-
-1. **Marked (exact).** The app marks its strings when it is rendered for
- review. The contract gains an optional `mark`, an environment variable
- the render's serve command runs with. With it set, the app wraps each
- string's output in private-use characters that carry the string's index
- (U+E000 *n* U+E001 text U+E002), as in-context translation editors do.
- This changes no markup, so attributes are covered too. Equipo's
+A mapping is evidence. It is never authority. The person confirms what an
+edit will change, and every edit is checked after it lands.
+
+**Where the mapping comes from**, strongest first:
+
+1. **Static file text.** The page is a static HTML file from the exported
+ preview, as Design's mockups are. The runner tokenizes that file the way
+ `html-tokens.mjs` does. It maps each rendered text run, and each
+ attribute value, to a byte range in the file. The match counts only when
+ the decoded source text equals the rendered text, and only at one place
+ in the file. Text that a script wrote or changed has no match.
+2. **Marks plus inventory.** An app with a contract that supports `mark`
+ and `inventory` (contract v2) can mark its strings when it renders for
+ review. `mark` names an environment variable for the render's serve
+ command. With it set, the app wraps each string's output in private-use
+ characters that carry the string's index in the inventory (U+E000 *n*
+ U+E001 text U+E002). This is how in-context translation editors work.
+ No markup changes, so attributes are covered as well. Equipo's
`copyText` does this under `EQUIPO_COPY_MARKS=1`. The runner strips the
marks before the copy is served.
-
- The page is untrusted, so the instance accepts a mark only when both
- hold:
- - the key is in the candidate's extraction (base-pinned scripts, run at
- the candidate);
- - the element's text equals that key's value once its placeholders are
- filled.
-
- Otherwise the element falls to method 2.
-2. **Matched (exact).** The element's text matches exactly one extracted
- string, with placeholders matched as wildcards. Generic projects use the
- generic literal extraction (Go, JS, TS, JSX, TSX, JSON, HTML templates),
- which gives the literal's file and byte range. When the text matches
- several strings, the editor lists them with their context, and the
- person picks one. Copy-review's lesson applies: changing a string used
- in several places changes all of them, so the editor says when a
- contract string is shared.
-3. **Located (agent).** No extracted string matches, as with text built in
- a template, or another app's file type. The edit becomes a request to
- the task's maker (Engineering or Design): "change this text from X to Y
- on page P". It carries the person's exact words, the element's selector
- and its text quoted as page content. After the change, the runner
- renders the page again and checks that the element now shows exactly
- the person's text. The tray shows **Changed** or **Couldn't confirm**.
-4. **Not in the code.** Text that comes from the app's data (a CMS post, a
- seed). The maker reports `not_in_code` with the place it found it, and
- the editor says so. v1 edits code only.
-
-Strings with markup inside (bold, links) and text inside an SVG can't be
-edited in v1; the editor offers Comment instead.
-
-### B4. Who applies a change, and what it means
-
-**Text edits are the person's words.** Apply sends the batch (at most 50
-strings) as one change on the task's branch, which becomes one new
-candidate:
-
-- **Marked or matched strings** are applied by the runner, with no model:
- - a contract project goes through the contract's base-pinned `apply`;
- - a generic project gets an exact replacement of the literal's byte
- range, escaped for its language. Only Go, JS, TS and HTML text are
- supported. Other kinds fall to Located.
-
- Tests change only through the contract's exact old-to-new literal rule,
- as Copy already does. In a generic project, a test that asserts the old
- text fails Checks and goes to the normal repair path.
-- **Located edits** are one maker step carrying all the located items.
-- **Placeholders** show as locked chips. The instance refuses a text whose
- placeholder multiset differs.
-- **Teaching.** Every marked or matched edit is also a Copy note in the
- person's words (origin `in-place`), the same as a task-card edit.
- Located edits teach too, once confirmed.
-
-**Acceptance.** In a contract project, an owner's own typed text for a key
-is accepted copy. The person typed it, and the copy rules exist to make
-sure a person has reviewed every string. In the Apply transaction the
-instance writes a **person acceptance** record (actor, key, exact text
-hash, candidate). The runner invokes `accept` for the keys whose final hash
-matches that record, as it does for Copy's records, with the marker
-`ACCEPTED BY <name> (in place, <date>)`. A member's edit is applied but
-stays pending for Copy or an owner (question 4). Nothing here weakens the
-release gate. Pending text still blocks a release.
-
-**Ask Copy** (slice B1b). The editor has an instructions box and **Ask
-Copy**, like copy-review's Reroll. Copy returns 2 or 3 phrasings in one
-structured call that carries the string, its neighbours on the page and
-the person's notes. Copy's phrasings are its words:
-- picking one is a choice, which teaches as a pick does;
-- editing one makes it the person's words.
-
-Ask Copy runs only on a tap, on the person's connections, at most 30 times
-an hour.
-
-**Comments are the person's words to the maker.** Send makes one maker
-round on the task, addressed by the person with two chips:
-- **Look** goes to Design when Design is active for the project, otherwise
- to Engineering;
-- **Wording** goes to Copy. In contract mode Copy proposes new text for the
- mapped key, which comes back to the tray as a choice, never as an
- applied change.
+3. **Inventory text match.** With no mark, the element's text is compared
+ with the inventory. Placeholders count as wildcards.
+
+**Marks and matches are hints from an untrusted page.** The editor shows a
+key as **Exact** only when both of these hold:
+- the element's text equals that key's value (placeholders filled in);
+- no other inventory key, or other byte range in the static file, has text
+ that could produce it.
+
+When several keys could produce the text, the editor lists them all with
+their context, and the person picks one, even if the page marked one of
+them. A mark can only pre-select.
+
+**Each edit is bound to:**
+- the confirmed key or file range;
+- the path;
+- the hash of the original text;
+- the candidate.
+
+Apply refuses an edit if any of these has moved.
+
+**Shared strings.** When one contract key is used in several places,
+changing it changes all of them. The editor says so (copy-review's lesson).
+
+**Checked after it lands.** After every apply, the runner renders the page
+again (B5) and checks that each edited element now shows exactly the
+person's text. If one doesn't, the tray says "Changed a string with the
+same words, but this text didn't change", and offers **Undo that one**.
+
+**No mapping in B1.** Text with no mapping (built in a template, from an
+app without a contract, or from the app's data) gets no outline in B1.
+Tapping it offers Comment. B2 adds **Located** edits: a request to the
+maker, with the person's exact words, the element's selector and its text
+quoted as page content. Text that comes from the app's data (a CMS post, a
+seed) is reported as not in the code.
+
+Strings with markup inside them (bold, links), and text inside SVG, can't
+be edited in v1. The editor offers Comment instead.
+
+### B4. Applying, teaching and accepting
+
+**One batch, one operation.** Apply sends the tray's edits, at most 50, as
+one batch. Send sends its comments, at most 20, as another. A batch has an
+id the client makes, and that id is its idempotency key, so a retry with
+the same id does nothing new. The batch is admitted in one transaction,
+which checks seven things:
+- the actor (from the session) is the task's creator;
+- the roster is current;
+- the task isn't merging, final or cancel-requested;
+- the latest step has finished, so no maker is running. If one is, Apply
+ is refused with "Design is working. Apply when it's done", and the tray
+ is kept;
+- no other batch is open on the task;
+- the tray's generation matches, which covers a second device;
+- each edit's bindings (B3) match the current candidate.
+
+**Applying edits.** The runner does it, with no model, in one commit on
+the task's branch:
+- **Static file text** gets an exact replacement of the bytes, escaped as
+ HTML text or as an attribute value.
+- **Contract keys** go through the contract's base-pinned `apply`. Tests
+ change only by the contract's exact old-to-new literal rule.
+- **Placeholders** must keep their order. The editor shows them as locked
+ chips that can't be reordered, and the instance refuses any change of
+ order, as `ValidateReview` does.
+
+The commit becomes the task's new candidate, and `AuthorizePublication`
+checks the expected branch head before the push. If validation fails,
+nothing is published, and every edit goes back to the tray with its
+reason. Fresh Checks and Review follow, as for any candidate. A task that
+was ready to merge goes back to review, and the switch says so before
+Apply.
+
+**Teaching.** The current rule stands: only the project's delegating owner
+teaches Copy. An edit by that owner writes a `copy_feedback` row with
+origin `in-place`, for that project. Anyone else's edit teaches nothing.
+
+**Accepting copy (contract v2, `accept_person`).** The copy rules exist so
+that a person has reviewed every string. An owner's own typed text has been
+reviewed, by them. So an owner's in-place edit of a contract key can be
+accepted as theirs, whether or not Copy is delegated:
+- **The record.** In the batch's transaction, the instance writes a
+ `copy_person_acceptances` row: project, task, batch, key, the hash of the
+ exact final text, the candidate, the actor, and the time.
+- **Dispatch.** The runner gets these records with the batch. It calls the
+ contract's `accept` with
+ `{"version":2,"kind":"person","keys":[{"key","hash"}],"name","date","record"}`.
+- **The marker.** The script writes
+ `COPY ACCEPTED BY <name> (in place, <date>, <record>)` only when the hash
+ of the applied text equals the record's hash.
+- **Release.** `copy-status.py verify` and `make copy-release-check` accept
+ that marker as a human acceptance, after checking the text hash, as they
+ do for historical human acceptances.
+- **Fail closed.** A contract without `accept_person`, or a runner below
+ the protocol, gets no person acceptance. The text stays pending for Copy
+ or an owner, and the tray says "Applied. Still needs copy review".
+- **Members.** A member's edit always stays pending (question 4).
+
+**Ask Copy** (slice B1b) is for the delegating owner on a delegated project
+only. For anyone else the box doesn't appear. The editor has an
+instructions box and **Ask Copy**, like copy-review's Reroll. Copy returns
+2 or 3 phrasings, in one structured call that carries:
+- the string;
+- its neighbours on the page, quoted as page content;
+- the person's notes.
+
+How the answer is recorded:
+- Picking a phrasing unchanged is a choice.
+- Editing a phrasing is stored as an **edited suggestion**: Copy's
+ phrasing (Copy's words) and the person's final text side by side. Model
+ origin is never erased, and an edited suggestion is never plain "words".
+- Typing into an empty box, without asking, is words.
+
+Accepting the text it becomes is a separate matter: an owner's final text
+is accepted as above, whoever wrote its first draft.
+
+Ask Copy's limits:
+- It runs on the person's connections, under Copy's model ceiling.
+- Per call: 8,192 tokens and 60 seconds.
+- Per person: one call in flight, 30 an hour, 100 a day.
+- Retries are idempotent on the tap's id, and usage is recorded as Copy.
+
+**Comments** (slice B2) are the person's words, sent on their tap. The
+person addresses each comment with one of two chips:
+- **Look** goes to the task's maker: Design when it is active for the
+ project, otherwise Engineering. All the Look comments in a batch become
+ one maker round. It counts against the maker's run limit and fix rounds
+ as Try again does. The person's Send is the person acting, as in 8.4.
+- **Wording** is offered only when the element maps to a key (B3), the
+ project is delegated, and the actor is the delegating owner. It goes to
+ Copy as one Ask Copy call per comment, under Ask Copy's limits, and the
+ phrasings come back to the tray as choices. It never applies anything.
+ Otherwise Wording isn't offered.
Each comment carries:
-- the page, viewport and element selector;
+- the page, the viewport and the element's selector (or the box);
- the element's text, quoted as page content;
- a crop of the region from the capture.
-Comment rounds count against the maker's run limit and fix rounds as Try
-again does. The person's Send is the person acting, as in 8.4. When the
-round ends, each comment shows **Done?** with **Resolve** and **Reopen**.
-Reopen sends it again with the person's added words.
+When the round ends, each comment shows **Done?**, with **Resolve** and
+**Reopen**. Reopen sends the comment again, with the person's added words.
+
+**Partial failure.** A batch's parts have their own outcomes: the edit
+commit; then, in B2, the Located edits and the Look round, as one maker
+step on top. If the maker step fails, the commit stays. The items that
+weren't done return to the tray as "Couldn't apply", with **Retry** (a new
+batch).
-### B5. Rebuild and refresh
+### B5. Rebuild, refresh, failure and storage
-After a batch lands on the branch:
-1. The runner renders the same page and viewport again from the new
- candidate (static export, or the running app once render.json exists);
+**Refresh.** After a batch changes the branch:
+1. the runner renders the same page and viewport from the new candidate;
2. it makes a new review copy;
-3. the overlay swaps it in.
+3. the overlay swaps the new copy in.
The tray shows "Updated 20 s ago", and **Before / After** switches between
-the two copies.
+the two copies. Live catches up on its own schedule (B1).
-Live updates on its own schedule: a new candidate means fresh Checks and
-Review, then the preview deploys as today. The switch shows "Live is
-behind: updating after review" until then.
-
-The tray reports progress per item, from records the instance holds:
-- for edits: Saved, Applying, Applied, Couldn't apply (with the reason);
+**Progress in the tray.** It comes from records the instance holds:
+- for edits: Saved, Applying, Applied, Applied (still needs copy review),
+ Couldn't apply (with the reason);
- for comments: Sent, Working, Done?.
-A task that is merging, done or cancelled offers no Edit text or Comment.
-An edit to a task that was ready to merge sends it back to review, and the
-switch says so before Apply.
+**Failures**, each shown where the copy would be. Live stays available
+through all of them.
+
+| Code | What the person sees |
+|---|---|
+| `renderer_missing` | "This project's runner can't render pages yet" |
+| `too_large` | "This page is too big for a review copy" |
+| `unsafe` | "Equipo couldn't make a safe copy of this page" |
+| `busy` | "The runner is busy. Try again in a minute" |
+| `no_page` | "This page isn't in the preview" |
+
+If an apply succeeds but the refresh fails, the tray says "Applied.
+Couldn't refresh the copy", with **Refresh**. One tap starts one render.
+The tray is never lost to a failure.
+
+**Storage.**
+- A task keeps only the newest 3 review copies for each page and viewport.
+- Copies are deleted 14 days after they were made, or when the task ends.
+- Quotas: 200 MiB per task and 1 GiB per team. Above a quota, the oldest
+ copies go first.
+- A comment's crop is kept with its comment, under task-file retention.
+
+**Rates.**
+- One render at a time per runner (the renderer's rule).
+- 30 review copies per person per hour.
### B6. Security
-- **Where code runs.** The overlay runs in the wrapper as Equipo's own
- script. Nothing from the preview runs alongside it. The review copy runs
- nothing, enforced three ways:
- - the allowlist sanitiser;
- - `script-src 'none'`;
- - the response's CSP sandbox without `allow-scripts`.
-
- It loads nothing either: every resource is a `data:` URL, so there are no
- beacons, tracking pixels or CSS that sends data out.
-- **Same origin.** The copy sits on Equipo's origin. With no script and no
- forms it can't read cookies or the DOM, and it can't post. Equipo's GET
- routes don't change state. Links have no targets, and the sandbox grants
- no navigation or popups.
-- **Fake controls.** A page can draw a fake Equipo button inside the copy.
- Real controls live only outside the frame, in the wrapper, and a tap
- inside the copy only selects text. The frame is labelled "Review copy.
- Nothing on it works."
-- **Text is data.** Element text, selectors and marks are page content.
- They are quoted and labelled whenever they reach a model, and they never
- grant anything. Mappings are verified against the trusted extraction
- (B3).
-- **Who.** Edit and Comment need a signed-in session; preview passes are
- Live only. The actor always comes from the session. Every POST checks
- CSRF. The roster, role and task creator are checked again in each write
- transaction. Only the creator can apply, and only an owner's text can be
- accepted.
-- **A person taps first** (AGENTS.md rule 4). Every request starts with the
- person's own tap:
- - a review copy (and before it reaches their browser, it passes the
- deterministic checks: sanitiser, limits, gitleaks);
- - a model call (Ask Copy, comments, located edits);
- - a branch change (Apply, Send).
-
- Typing only autosaves the tray on the instance. Publishing the branch
- goes through `AuthorizePublication` as every maker does.
-- **Limits.** One render at a time per runner (renderer rules); 30 review
- copies per person per hour; 50 edits and 20 comments per batch; comments
- at most 1,000 bytes.
-- **Audit.** Each review copy made, apply, send, resolve and reopen is
- audited with the actor and ids, never the text.
+**What runs.**
+- **The overlay** is Equipo's own script, running on the review page.
+ Nothing from the preview runs beside it.
+- **The review copy** runs nothing, for three reasons: the allowlist
+ sanitiser; `script-src 'none'`; and, unless the iOS fallback is needed
+ (B2), a CSP sandbox without `allow-scripts`.
+- **No requests go out.** Every resource in the copy is inline or a
+ `data:` URL, so there are no beacons, tracking pixels, or CSS that sends
+ data out.
+
+**Same origin.** The copy lives on Equipo's origin, but with no script and
+no working forms it can't read cookies or the DOM, and it can't post.
+Equipo's GET routes don't change state. Links have no targets, and the
+sandbox allows no navigation and no popups.
+
+**Fake controls.** A page can draw a fake Equipo button inside its copy.
+The real controls live only outside the frame, and a tap inside the copy
+only selects. The frame is labelled "Review copy. Nothing on it works."
+
+**Text is data.** Element text, selectors and marks are page content.
+- Whenever they reach a model, they are quoted and labelled.
+- They never grant anything.
+- What an edit changes is decided by the person's confirmation, and is
+ checked after it lands (B3).
+
+**Who can do what.**
+- Edit text and Comment need a signed-in session, and are for the task's
+ creator only.
+- The actor comes from the session, and every POST checks CSRF.
+- Each write transaction checks the roster, the role and the creator
+ again.
+- Teaching, and Ask Copy and Wording, follow Copy's delegation (B4).
+- Person acceptance is for owners only.
+
+**A person taps first** (AGENTS.md rule 4). Each of these starts from the
+person's own tap:
+- **A review copy.** It also has to pass the deterministic checks
+ (sanitiser, limits, gitleaks) before it reaches their browser.
+- **A model call:** Ask Copy, and comments.
+- **A branch change:** Apply and Send.
+
+Typing only autosaves the tray on the instance.
+
+**Audit.** Each review copy made, each batch, and each resolve and reopen
+adds an audit row with the actor and ids, never the text.
### B7. What comes from the copy-review skill
-**Ported**, and rewritten as Go and Equipo static JS:
-- the preview controller: sanitise, find bindings, draw markers, keep the
- page inert (including Enter and Space), select several ids on one
- element, update text as it is typed;
-- `preview-check`'s rule that bound text must equal its string, and that
- bindings can't nest, which becomes B3's mark check;
-- the editor's layout: side panel, bottom sheet, locked placeholders;
-- the autosaved draft with a generation, so a page showing old strings
- can't apply;
-- Reroll's prompt shape for Ask Copy: voice rules, the nearby strings, and
+**Ported**, as Go and Equipo static JS:
+- **The preview controller:** sanitising, finding bindings, drawing
+ markers, keeping the page inert (including Enter and Space), selecting
+ several ids on one element, and updating text as the person types.
+- **The frame-escape guard.**
+- **`preview-check`'s rules:** bound text must equal its string, and
+ bindings can't nest. These become B3's mapping checks.
+- **`html-tokens.mjs`'s source offsets**, which become B3's static file
+ text.
+- **The editor's layout:** side panel, bottom sheet and locked
+ placeholders.
+- **The autosaved draft with a generation.**
+- **Reroll's prompt shape for Ask Copy:** voice rules, nearby strings, and
the person's hand edits as taste ("a demonstrated preference outranks a
- described one");
-- `snapshot.mjs`'s way of inlining assets, now run in the renderer;
-- the frame-escape guard: when the frame leaves the review copy, detach and
- bounce back, a bounded number of times.
-
-**New**:
-- the review-copy job, its serialiser and text map;
-- marks;
-- the Go sanitiser and the copy's CSP;
-- mapping against contract and generic extraction;
-- runner-applied exact replacement;
+ described one").
+- **`snapshot.mjs`'s asset inlining**, now done in the renderer.
+- **The arrangement already tested on iOS**, kept as B2's fallback.
+
+**New:**
+- the review-copy job, serialiser and text map;
+- `inventory`, `mark` and `accept_person` in contract v2;
+- the Go sanitiser and both CSPs;
+- confirmed mappings and checking after apply;
+- batches;
- person acceptance;
-- comments with anchors and crops, and their routing;
+- comments, with anchors, crops and routing;
- the refresh loop;
-- the wrapper's switch.
+- the review page.
-**Not taken**: the skill's always-on app and its file layout, the reroll
-jail, `serve.sh` and its tailnet serving. Equipo has its own runners,
-connections and origin.
+**Not taken:**
+- the skill's always-on app and its file layout;
+- the reroll jail;
+- `serve.sh` and its tailnet serving.
## C. The copy-review skill and Equipo
-They do different jobs today:
-- **The skill** is a drafting gate for any agent in any repository on
- docs-t1. Copy is written into `strings.json` and reviewed before it
- enters files.
+The two do different jobs today:
+- **The skill** is a drafting gate for any agent, in any repository on
+ docs-t1. Copy goes into `strings.json` and is reviewed before it enters
+ files.
- **Equipo's Copy** reviews strings inside Equipo's task pipeline.
-The import (`/conversation/settings/copy`) already carries the skill's hand
-edits into Copy's notes.
+The import on `/conversation/settings/copy` already carries the skill's
+hand edits into Copy's notes.
-**Recommendation:** keep the skill as it is, and later make it a client of
-Equipo for Equipo projects. Do this after B1 has been used for a few weeks:
+**Recommendation:** keep the skill as it is. Make it a client of Equipo for
+Equipo projects later, once B1 has been in use for a few weeks:
-1. **Submit to Equipo.** `copy-review submit --equipo <project>` sends
+1. **Submit to Equipo.** `copy-review submit --equipo <project>` would send
`strings.json` and the preview through a scoped agent token on the
- person API. Equipo shows it as an in-place review on a review copy made
- from the preview folder, through the same sanitiser and CSP. The result
- goes back to the agent in today's `result.json` shape. Edits teach Copy
- directly, with no import step.
-2. **Shared taste.** The skill's Reroll reads the person's Copy notes
- through the person API, so taste is shared both ways.
+ person API. Equipo would show it as an in-place review, on a review copy
+ built from the preview folder through the same sanitiser and CSP. The
+ result would go back to the agent in today's `result.json` shape. The
+ delegating owner's edits would teach Copy directly, with no import.
+2. **Shared taste.** The skill's Reroll would read the person's Copy notes
+ through the person API, so taste goes both ways.
-The skill stays on its own for repositories outside Equipo and for agents
-that have no Equipo token. It is not deprecated.
+The skill stays standalone for repositories outside Equipo, and for agents
+with no Equipo token. It is not deprecated.
## D. Slices
-1. **A: Copy training (M).** The drill prep job, sessions and drills, the
- answers as notes, the switch and the sidebar offer, Copy's page through
- the shared `taste_notes` partial (it builds `chat_taste_notes` if 8.6
- hasn't), Forget and the revision fence, notes in Copy's prompt, the
- guess rate.
-
- Witness on staging, then production: Paul starts a session on Equipo's
- strings and answers 5 drills. Copy's page shows the new notes and the
- guess. He forgets one. The next Copy pass's dispatch carries the new
- revision and quotes the notes.
-2. **B1: In-place text edits (L).** The review-copy job, the sanitiser and
- CSP, the wrapper's switch, marks (with Equipo's `copyText`), matching,
- the tray, Apply through the runner, person acceptance, the refresh.
- Static previews come first. Equipo's own pages need running-app renders
- (dynamic specialists slice 3), so B1 either follows that slice or lands
- with it.
-
- Witness: on a Design exploration, Paul edits a heading in place and taps
- Apply. The review copy refreshes with his words, and the branch has one
- commit with his text and his acceptance. Then the same on an Equipo
- settings page, once render.json exists.
+1. **A: Copy training (M).**
+ - Contents: `inventory` (contract v2, with Equipo's script); the drill
+ prep job; sessions and drills; answers as notes; the switch and the
+ sidebar offer; Copy's page through the shared `taste_notes` partial
+ (built here if 8.6 hasn't built it); Forget with tombstones and the
+ revision fence; notes in Copy's prompt; the guess rate.
+ - Witness, on staging and then production: Paul starts a session on
+ Equipo's strings and answers 5 drills. Copy's page shows the new notes
+ and the guess. He forgets one. The next Copy pass's dispatch carries
+ the new revision and quotes the notes.
+2. **B1: In-place text edits (L).**
+ - The iOS gate (B2) comes first.
+ - Contents: the review-copy job; the sanitiser and both CSPs; the review
+ page; static file text mapping; marks and inventory (with Equipo's
+ `copyText`); the tray and batches; applying through the runner;
+ `accept_person`; refresh, failures and storage.
+ - Static previews work first. Equipo's own pages need running-app
+ renders (dynamic specialists slice 3), so that part follows that
+ slice.
+ - Witness: on a Design exploration, Paul edits a heading in place and
+ taps Apply. The review copy refreshes with his words, and the branch
+ has one commit with his text. Then the same on an Equipo settings
+ page once render.json exists, where the commit also carries his
+ acceptance marker.
3. **B1b (S).** Ask Copy in the editor, and **Change it in the app** on a
- drill rewrite (question 6), reusing B1's apply path on a new task.
-4. **B2: Comments (M).** Pins and boxes, Look and Wording, crops, maker
- rounds, Done? with Resolve and Reopen, and Located edits.
+ drill rewrite (question 5), through B1's apply path on a new task.
+4. **B2: Comments and Located edits (M).** Pins and boxes, Look and
+ Wording, crops, the maker round, Done?, Located edits, and the
+ "not in the code" report.
5. **C (S to M, later).** The skill as an Equipo client.
-Every slice:
-- adds a protocol and additive migrations;
-- puts its strings in `copy.go`, marked pending for copy review;
-- gets a UX pass in the mockup kit first.
+**In every slice:**
+- a new protocol and additive migrations;
+- strings in `copy.go`, marked pending for copy review;
+- a UX pass in the mockup kit first.
-Native clients keep Live only, and drills come to native after the web
+**Native clients** keep Live only. Drills come to native once the web
version has settled.
## E. Questions for Paul
-1. **Owners only for training in v1?** Copy works only for owners, so a
- member's notes would change nothing yet. *Recommend:* yes. Members come
- later, if Copy starts using a task creator's notes for suggestions.
-2. **Should the guess rate change anything?** For example, fewer flags
- once Copy guesses well. *Recommend:* show it only, for now, and decide
- once there are a few weeks of numbers.
-3. **Default scope.** *Recommend:* picks and kept-as-is answers apply to
- all your projects, and rewrites to their own project. You can forget any
- of them.
+1. **Training only where Copy works for you.** Copy's existing rule is
+ that it makes no calls without delegation, so drills come only from
+ projects where you've let Copy accept for you. *Recommend:* yes. Members
+ come later, if ever.
+2. **Should the guess rate change anything?** For example, fewer flags once
+ Copy guesses well. *Recommend:* show it only, for now, and decide after
+ a few weeks of numbers.
+3. **Default scope.** *Recommend:* picks and "turned these down" cover all
+ your projects; rewrites and "kept it" cover their own project. Any of
+ them can be forgotten.
4. **Your typed text accepted without Copy.** In a contract project, an
- owner's in-place edit is marked accepted by them, and a member's stays
- pending. *Recommend:* yes.
-5. **Blind picks.** The current wording is hidden among the options until
- you pick. *Recommend:* yes. It keeps the choice about the words rather
- than about what's already there.
-6. **Changing a string from a drill.** *Recommend:* in B1b, a **Change it in
- the app** tap on a rewrite. It starts a small task with your words,
- through B1's apply path. Not in A, which never touches a repository.
-7. **Generic projects in drills.** Their extraction picks up technical
- strings. *Recommend:* contract projects only, until there is a way to
- filter those strings out.
-8. **Commenting on the live page.** States that need script (menus, open
- dialogs) can't be reached in a review copy. *Recommend:* later. A
- comment on Live would carry only a capture and the person's words, with
- no element mapping.
+ owner's own in-place edit gets their acceptance marker. A member's edit
+ stays pending. *Recommend:* yes.
+5. **Changing a string from a drill.** *Recommend:* in B1b, a **Change it
+ in the app** tap on a rewrite. It starts a small task with your words,
+ through B1's apply path. A itself never touches a repository.
+6. **Generic projects in drills.** Their extraction picks up technical
+ strings. *Recommend:* contract projects only, until a project can say
+ which strings people read.
+7. **Commenting on the live page.** States that need script, such as menus
+ and open dialogs, can't be reached in a review copy. *Recommend:* later.
+ A comment on Live would carry a capture and your words, with no element
+ mapping.
+
+## F. Review log
+
+**Astra round 1** (NOT READY, 15 findings). All were taken:
+- **Marks.** Marks are hints. Ambiguity needs the person's pick, and each
+ edit is bound and checked after it lands (B3).
+- **Model origin.** Edited suggestions keep Copy's original beside the
+ person's text (A5, B4).
+- **Delegation.** Training, Ask Copy, Wording and teaching all follow
+ Copy's delegation (A1, B4).
+- **The iOS gate.** A test under the exact headers, with one permitted
+ fallback (B2).
+- **A full string list.** `inventory` lists every string at a commit, and
+ static file text maps Design mockups (A3, B3).
+- **Person acceptance**, end to end, failing closed (B4).
+- **Batches.** One idempotent batch, admitted against the task's state,
+ with each partial outcome defined (B4).
+- **Complete CSPs**, with stylesheets inlined (B2).
+- **Two pages.** A separate review page, so Live being behind no longer
+ returns 404 (B1).
+- **Placeholders** keep their order (A2, B4).
+- **Routing.** Wording is offered only where it can work, and mixed
+ batches become separate steps (B4).
+- **Ask Copy** has full budgets (B4).
+- **Learning.** Size limits per origin, the same pending rule, and the
+ counts that show (A5).
+- **Forget tombstones** (A7).
+- **Failures, retention, quotas** (A3, B5).
## 9. Mockups
-At 390 and 1280 wide, light and dark, from Equipo's own `tokens.css`,
+At 390 and 1280 wide, light and dark, built from Equipo's own `tokens.css`,
`theme.css` and `equipo.css`:
-1. Copy's page: what Copy knows, the Train block, the notes with Forget.
+1. Copy's page: what Copy knows, the Train block, and the notes with
+ Forget.
2. A pick drill, before the pick, and after it with the reveal.
3. A rewrite drill.
-4. Edit text on a review copy: the outlines, the editor, the tray.
-5. Comment on a review copy: pins, the Look and Wording chips, the tray.
+4. Edit text on a review copy: outlines, the editor and the tray.
+5. Comment on a review copy: pins, a box, the Look and Wording chips, and
+ the tray.
-Shared at: (link added once shared).
+Shared at
+[https://copy-trainer-mockups.docs-t1.dev.platform.tito.io](https://copy-trainer-mockups.docs-t1.dev.platform.tito.io)
+(tailnet only).