docs: specify Copy specialist and failed-check routing
1 file changed,
+300
−0
docs/superpowers/specs/2026-11-13-copy-specialist-design.md+300 −0
CI passed — run details
diff --git a/docs/superpowers/specs/2026-11-13-copy-specialist-design.md b/docs/superpowers/specs/2026-11-13-copy-specialist-design.md| new file mode 100644 |
| index 00000000..64662c5d |
| --- /dev/null |
| +++ b/docs/superpowers/specs/2026-11-13-copy-specialist-design.md |
| @@ -0,0 +1,300 @@ |
| +# Copy specialist and failed-check routing |
| + |
| +Status: proposed, 2026-11-13. Spec only, based on main `3ab2a3a2` and |
| +Paul’s approved brief of the same date. Implementation follows review of |
| +this spec, with failing tests first and guard mutations recorded. |
| + |
| +Equipo must finish a copy review before it judges a changed interface. |
| +On staging, pending strings and missing inventory rows repeatedly sent |
| +work back to Engineering, which could not accept the copy. One task spent |
| +10.8 million tokens. Copy will review under the owner’s standing delegation; |
| +scripts will keep the repository’s records consistent. |
| + |
| +## Scope and existing seams |
| + |
| +The chain becomes Engineering → Copy when needed → Checks → Review → the |
| +existing merge gate. Copy does not grant merge or deployment authority. |
| +Research remains before Engineering and keeps its separate, read-only |
| +profile. This change does not redesign playbooks, review unrelated prose, |
| +translate an app, repair application bugs through Copy, or weaken checks. |
| + |
| +The implementation seams are: |
| + |
| +- `internal/equipo/chat/review.go`: today only Engineering establishes a |
| + candidate, and every failed check calls `fixRound` for Engineering. |
| +- `internal/equipo/triage/triage.go` and `chat/triage.go`: pure classification, |
| + source-bound housekeeping actions, daily budgets and restart recovery. |
| +- `internal/wire/tasks.go`, `internal/runner/thin/engineer.go` and |
| + `internal/schedule`: steps, contained edits, brokered publication and |
| + connection/model selection. |
| +- `internal/specialist/menu.go` and `chat/specialists.go`: Research’s closed |
| + profile and owner grants. Copy is a built-in editing role, like Engineering; |
| + reserve its name and give it a fixed launch policy, not Research’s capability. |
| +- `internal/runner/thin/desk.go` and `chat/notebook.go`: bounded notes with |
| + provenance. These currently serve the coordinator and Assistant, not a |
| + general specialist notebook. Copy needs a separate namespace. |
| + |
| +## Trigger and repository contract |
| + |
| +After each Engineering candidate is published, compare it with the last |
| +Copy-accepted candidate in this task, or the task’s original base. Record |
| +the comparison even when Copy is skipped. Later Engineering edits, |
| +rebases and owner changes invalidate acceptance for affected strings. |
| + |
| +Read repository guidance from the task’s base revision. Support an optional |
| +versioned `.equipo/copy.json` contract declaring app-copy paths, exclusions, |
| +an extraction command and bookkeeping commands as argument arrays. Document |
| +these commands in `AGENTS.md`, with Make targets if useful. Candidate changes |
| +to this contract cannot broaden their own permissions. The runner knows the |
| +contract format, never Equipo-specific file paths or test names. |
| +Commands use validated repository-relative paths and bounded structured input, |
| +never shell text assembled from diagnostics. Pin their definitions and code to |
| +the trusted base, as checks are pinned, while reading the candidate’s files. |
| + |
| +An extractor returns stable string IDs, source locations, old/new values, |
| +display context and placeholder constraints. In Equipo it reads |
| +`internal/equipo/copy.go`, including named constants and runtime diagnostics. |
| +Elsewhere, without a contract, inspect changed templates, localisation files, |
| +accessibility text, interface literals, notifications and displayed errors. |
| +Exclude code comments, internal docs, generated/vendor content and test data. |
| +Ambiguous literals go to Copy for classification; uncertainty or failed |
| +extraction never means “no copy”. A docs-only or logic-only change with no |
| +possible app strings skips the model. A generic repository needs no inventory. |
| + |
| +Copy sees the bounded diff and nearby display context, house rules, verified |
| +owner corrections and its notes. It records reviewed IDs and hashes of the |
| +final values, or a reason that a candidate contains no app copy. Any unresolved |
| +surface blocks acceptance and goes to the task’s coordinator path. |
| + |
| +## Authority, edits and order |
| + |
| +The standing delegation in this brief authorises Copy for oficina/equipo. |
| +Record its owner, source and revision as authority; do not turn a repository |
| +comment or notebook inference into a grant. Other projects use their recorded |
| +owner delegation. Without one, Copy can propose wording but cannot mark it |
| +accepted. Recheck current owner status, delegation, task revision and attempt |
| +at dispatch and before publication. Revocation stops queued work and prevents |
| +publication from an attempt already running. |
| + |
| +Copy applies plain, warm, short language; no em dashes, exclamation marks or |
| +jargon; curly quotation marks and apostrophes in prose; concise UI labels. |
| +Preserve literal syntax, placeholders, interpolation order and product meaning. |
| +An owner’s exact accepted wording wins. A question about meaning goes to the |
| +coordinator rather than being guessed away. |
| + |
| +Copy may edit identified app strings, directly corresponding copy expectations |
| +in tests, and repository-declared bookkeeping outputs. It may not alter program |
| +logic, assertions unrelated to wording, checks, policy or unrelated docs. The |
| +runner validates the final diff against this scope before committing as Copy. |
| +Repository commands run inside the same containment and face the same diff |
| +check. The model has Engineering’s task worktree and shell containment, no |
| +forge credential or general network access. Only the existing provider relay |
| +is available; the runner brokers fetch and push outside the model’s sandbox. |
| +No unsandboxed fallback is allowed for Copy. |
| + |
| +Copy starts a fresh session, not Engineering’s kept session. On completion, |
| +the runner publishes to the same task branch against the expected head. A |
| +Copy commit becomes the candidate; prior checks, Review and merge eligibility |
| +do not apply. A no-edit acceptance remains bound to the existing commit. |
| +Checks and Review then judge that exact candidate. Carry all editing model |
| +families forward to Review’s selection and independence label; do not replace |
| +Engineering’s identity with Copy’s or call Copy independent Review. |
| + |
| +## Repository bookkeeping |
| + |
| +Add two repo-owned commands during implementation, with dry-run and verify |
| +modes. They read real files and compute hashes; a model never fabricates rows. |
| + |
| +1. `python3 scripts/copy-status.py pending|accept --keys ...`: update each |
| + selected `copy.go` marker and its exact-text row in the consolidated Plan 3 |
| + inventory. Engineering uses `pending` after adding or changing a string. |
| + Copy uses `accept` with a review record identifying the delegated reviewer, |
| + delegation source, reviewed input commit, keys and final text hashes. |
| + Validate everything before writing either file; use recoverable replacement |
| + so interruption cannot leave a silently accepted half-update. Reject stale |
| + hashes, unknown keys and conflicting rows. Repeat invocation is a no-op. |
| + Preserve historical reports, unrelated rows and human review provenance. |
| +2. `python3 scripts/reference-allow.py --path ... --lines ... --reason ...`: |
| + calculate the scanner’s exact line hashes, matched tokens and counts for |
| + explicit lines. Require a reason for each legitimate retained reference. |
| + Reconcile only superseded entries explicitly covered by the operation; |
| + unrelated stale entries remain failures. No wildcard or whole-repo approval. |
| + A reference that restores an obsolete dependency needs Engineering, not an |
| + automatic exemption. Repeated invocation produces identical JSON. |
| + |
| +Today `TestPlan3ReleaseBoundaries/inventory` accepts a fixed list of reviewer |
| +names and dates. Replace that list for new records with a validated delegated |
| +acceptance format and matching per-string hashes; keep historical acceptances. |
| +Do not label Copy’s work as an old Astra pass. Changed text makes its review |
| +record stale. Keep release refusal for pending copy, exact inventory coverage, |
| +placeholder checks and exact reference allowances. |
| + |
| +Rewrite `AGENTS.md`’s copy section during implementation to name these commands, |
| +the pending → delegated review → accepted sequence and the unchanged release |
| +gate. The current assignment changes only this spec. README prose stays as is. |
| + |
| +## Failed checks and repeated failures |
| + |
| +Classify before `fixRound` can dispatch Engineering. Use completed check results |
| +bound to repository, candidate, gate and attempt. Repository adapters provide |
| +structured failure IDs and categories: copy, bookkeeping or other. Equipo’s |
| +adapter recognises the inventory, release-copy and reference-scan diagnostics. |
| +The generic runner does not recognise them by hardcoded names. |
| +Adapters must account for every failed check unit, including units that produce |
| +no recognised diagnostic. Their output cannot turn a failing unit into a pass. |
| + |
| +Only a complete failure set consisting entirely of copy/bookkeeping failures |
| +may take the mechanical path. A truncated log, missing result, unmatched |
| +failure or mixed application failure cannot prove this. Re-run a bounded |
| +deterministic diagnostic when it can supply the missing result; otherwise use |
| +Engineering or a coordinator recommendation. Text in a log never grants |
| +permission to execute a command or accept a reference. |
| + |
| +- Transient stop: retain the existing one automatic retry after proven |
| + termination, adding Copy to the eligible roles. |
| +- Copy-only failure: schedule Copy on the existing candidate. Already reviewed |
| + wording with missing records uses the bookkeeping command without a model. |
| +- Bookkeeping-only failure: run the declared, scoped command in an editing |
| + step without a model when the required reason and inputs are established. |
| + Ambiguous exemptions go to judgement. |
| +- Mixed or real test failure: Engineering receives all failures. Its resulting |
| + candidate still passes through Copy detection. |
| +- Judgement or exhausted work: retain the existing task-linked “Ask the |
| + coordinator” path with evidence and a recommendation. No new autonomous |
| + coordinator turn or general task-splitting system is needed for this slice. |
| + |
| +Persist a versioned failure signature: a hash of sorted gate IDs, test/subtest |
| +IDs, diagnostic codes and stable subjects such as string keys or reference |
| +paths/tokens. Remove durations, timestamps, commit IDs, temporary roots and |
| +line-number drift. Preserve meaningful failure differences. Store the complete |
| +normalised set alongside its hash and source attempt; unknown is not empty. |
| + |
| +Before dispatching fix round 2, compare the failures after round 1 with those |
| +that caused round 1. If the complete sets match, stop before spending on round |
| +2. If a second round is already running, stop at its next proven check result |
| +when the same signature recurs; never launch another model call for it. Do not |
| +kill a process based on a matching substring in a live log. Partial overlap |
| +with changed failures follows the normal cap. |
| + |
| +Share the existing two automatic repair rounds across Engineering, Copy and |
| +bookkeeping. A normal post-Engineering Copy pass is part of that round, not an |
| +extra repair allowance. Changing specialists or restarting cannot reset the |
| +count. The card records the repeated failure, both attempts/commits, work |
| +already tried and the coordinator recommendation. A person can explicitly |
| +request another round through the existing action; it does not silently reset |
| +automatic history or spending limits. |
| + |
| +Use the housekeeping ledger’s immutable source snapshot, consumed keys and |
| +transaction checks for mechanical routing. Retain its exclusions for cancelled, |
| +held, folded, ended or merging tasks, removed owners and paused automation. |
| +Mechanical repair consumes the existing daily automatic-round allowance of |
| +three, in addition to the per-task cap. A budget hold is distinct from failure. |
| + |
| +## Learning and cost |
| + |
| +Reuse notebook entries and atomic storage under a Copy namespace scoped to |
| +owner and repository, separate from coordinator/Assistant notes. Keep the |
| +existing bounds: 40 entries, 400 bytes each, 12 KiB total, with a 6 KiB prompt |
| +excerpt and bounded read access to the remainder. Notes cannot grant authority. |
| + |
| +Capture owner edits and rejections through authenticated review/message events. |
| +On a later change, compare previously accepted strings with the new values and |
| +use verified forge actor evidence for direct owner edits. A commit author name |
| +alone is insufficient. An imported external copy review needs its original |
| +before/after result and verified owner association; do not scrape arbitrary |
| +local files. Keep event IDs or commit/path/key references for deduplication. |
| + |
| +Record a compact before/after example and the owner’s stated reason. If no |
| +reason was given, mark the explanation inferred; never invent an owner rule. |
| +Read these notes before the next Copy run. Preserve exact human wording and |
| +let the owner inspect, correct or clear Copy’s notes separately. Missing or |
| +unreadable notes are reported as unavailable, not overwritten with an empty set. |
| + |
| +Learning/compaction uses housekeeping’s existing judgement reservation of |
| +37,500 tokens and its shared daily four-turn/150,000-token limit. Batch pending |
| +feedback, consume each source once, and carry the remaining allowance across |
| +retries. Extend the principal narrowly for Copy’s own notes; it remains unable |
| +to replace the coordinator’s notebook or dispatch unrelated work. |
| + |
| +For Copy reviews, use `cheap`/`standard` tiers through the existing scheduler, |
| +with `standard` as a hard tier ceiling and the normal spend-derived cap when |
| +lower. Filter higher tiers before selection: today `PickModel` can fall back |
| +above its cap. Apply the ceiling to subscription choices too; an unclassified |
| +or unavailable eligible model produces a hold, not a strong-model fallback. |
| +Retain project/account restrictions and record the actual model and tier. |
| + |
| +Implementation defaults: five minutes and 37,500 measured tokens per Copy pass; |
| +112,500 Copy-review tokens per task across all attempts and retries. These are |
| +engineering limits, not extra owner decisions. Stop on observed exhaustion, |
| +carry remaining allowances durably, and include provider cache usage. Harnesses |
| +can report usage late, so this is not a promised hard billing ceiling: charge |
| +overruns, mark incomplete usage unknown and never replenish an uncertain |
| +allowance. Bookkeeping itself uses zero model tokens. Record learning spend |
| +under its housekeeping action, without double charging it as a Copy review. |
| + |
| +## Protocol, migration and rollout |
| + |
| +Add `SpecialistCopy` and a negotiated `ProtocolCopy` after current protocol 20 |
| +(allocate the actual next number at implementation). Dispatch/report data must |
| +carry the compared commits, detection result, review hashes, delegation |
| +revision, budget remainder and failure evidence. Add a scoped notebook/feedback |
| +exchange. Bind each report to its runner, task, step and attempt. Old peers |
| +must never receive Copy as Engineering or have required acceptance fields |
| +silently removed. Hold affected work with an update reason until both peers |
| +support it; check compatibility again after reconnect. |
| + |
| +Use additive app migrations for copy review/feedback records, scoped notebook |
| +views, failure signatures and repair accounting; register them in `Models` |
| +and `Schema`. Add runner-state migrations for notes, source cursors and remaining |
| +budgets. Derive existing repair counts from recorded Engineering rounds, leaving |
| +unknown signatures unknown. No migration accepts copy or fabricates a grant. |
| + |
| +Roll out repo scripts and guard support first, then capable runners and instance |
| +code, then enable delegated Copy for this project. Repositories without the new |
| +contract still receive generic string review. If rollout is disabled or peers |
| +are downgraded, affected tasks wait without losing pending reviews or history. |
| + |
| +After an operator’s versioned rollout, re-triage current branch heads once, |
| +using a durable recovery key per task/candidate. The initial recovery grants |
| +one mechanical attempt for an eligible legacy task whose Engineering rounds |
| +were already spent, charged to the daily allowance; preserve those old rounds. |
| +Copy edits still require fresh Checks and Review under the existing merge policy. |
| +Legacy tasks based before the repo commands landed first need an explicit |
| +rebase onto that reviewed tooling revision, with conflicts sent to Engineering. |
| +Never execute newly supplied candidate scripts as trusted recovery commands. |
| + |
| +| Staging task prefix | Recovery | |
| +| --- | --- | |
| +| `tk25j65kpelv`, `tkizl6frmnij`, `tknitqeua7yy` | Reconfirm copy-only failures, review changed strings and synchronise inventory/acceptance, then Checks and Review | |
| +| `tk3j4tcivyrx` | Reconfirm bookkeeping-only failure, classify the exact retained references, run the scoped command, then Checks and Review | |
| +| `tkplvk6zce6q` | Includes a real `/conversation` 500; Engineering must repair it as well as bookkeeping | |
| +| `tkataquuxfrw` | Real headless failures remain Engineering work | |
| + |
| +The first two rows are the four mechanically stuck tasks in the brief. These |
| +are supplied staging observations, not fresh diagnoses. Re-fetch evidence at |
| +recovery; do not operate on prefix matches or auto-recover mixed failures. |
| + |
| +## Verification before implementation is complete |
| + |
| +Write failing contracts first for detection with/without repo files, a later |
| +string edit, docs-only skip, malformed extraction, no-op acceptance and Copy’s |
| +candidate invalidating old checks/review. Cover revoked authority, scope escape, |
| +network denial, old peers, duplicate reports and stale branch heads. |
| + |
| +Script tests cover pending/accepted round trips, changed hashes, placeholders, |
| +duplicate rows, escaped table text, interrupted writes, idempotence, exact line |
| +hash/count parity and refusal of blanket allowances. Routing fixtures reproduce |
| +all supplied failures, including mixed failures and incomplete logs. Verify the |
| +same signature stops before round 2, changed signatures retain the cap, and |
| +restart or specialist switches cannot reset budgets. Test verified feedback, |
| +owner separation, inferred reasons, compaction, late usage and recovery once. |
| + |
| +Break each guard deliberately, observe its targeted test fail, restore it and |
| +record commands/results in the implementation controller report. Run the |
| +affected suites while building and `make ci` once before handoff, including |
| +release-copy checking, migration checks and headless cards. Do not run a full |
| +implementation gate or claim mutation coverage for this spec-only commit. |
| + |
| +No further product ruling is required: Paul has approved the delegation, |
| +scope, learning, script bookkeeping and routing. Implementation should start |
| +only after the requested spec stop has been reviewed. |