@bbcsoftwarefactory/cli 0.1.1 → 1.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (155) hide show
  1. package/dist/audit-ledger.d.ts +2 -0
  2. package/dist/audit-ledger.js +71 -0
  3. package/dist/bbc-install.d.ts +2 -0
  4. package/dist/bbc-install.js +1278 -0
  5. package/dist/bbc.js +87 -3
  6. package/dist/bundle/commands/daily/SKILL.md +112 -0
  7. package/dist/bundle/commands/daily/adapters/command.md +17 -0
  8. package/dist/bundle/commands/daily/adapters/gemini.toml +17 -0
  9. package/dist/bundle/commands/issue-clean-and-close/SKILL.md +85 -0
  10. package/dist/bundle/commands/issue-clean-and-close/adapters/command.md +17 -0
  11. package/dist/bundle/commands/issue-clean-and-close/adapters/gemini.toml +17 -0
  12. package/dist/bundle/commands/issue-clean-and-close/references/policy.md +87 -0
  13. package/dist/bundle/commands/recap/SKILL.md +84 -0
  14. package/dist/bundle/commands/recap/adapters/command.md +17 -0
  15. package/dist/bundle/commands/recap/adapters/gemini.toml +17 -0
  16. package/dist/bundle/installer/clients.json +103 -0
  17. package/dist/bundle/skills/code-quality-gate/SKILL.md +58 -0
  18. package/dist/bundle/skills/code-quality-gate/references/gate-bigo.md +31 -0
  19. package/dist/bundle/skills/code-quality-gate/references/gate-earlyreturn.md +73 -0
  20. package/dist/bundle/skills/code-quality-gate/references/gate-typesafe.md +32 -0
  21. package/dist/bundle/skills/code-quality-gate/references/output-schema.yml +40 -0
  22. package/dist/bundle/skills/delivery-coordinator/SKILL.md +80 -0
  23. package/dist/bundle/skills/delivery-coordinator/references/hud-output.md +55 -0
  24. package/dist/bundle/skills/delivery-coordinator/references/intake.md +86 -0
  25. package/dist/bundle/skills/delivery-coordinator/references/issue-claim.md +143 -0
  26. package/dist/bundle/skills/delivery-coordinator/references/issue-dedup.md +38 -0
  27. package/dist/bundle/skills/delivery-coordinator/references/sleuth-regression-exercise.md +60 -0
  28. package/dist/bundle/skills/delivery-coordinator/references/visual-reference.md +45 -0
  29. package/dist/bundle/skills/delivery-coordinator/references/worktree-isolation.md +19 -0
  30. package/dist/bundle/skills/documentation-steward/SKILL.md +43 -0
  31. package/dist/bundle/skills/documentation-steward/references/discovery.md +17 -0
  32. package/dist/bundle/skills/documentation-steward/references/handoff.md +15 -0
  33. package/dist/bundle/skills/greptile-review-loop/SKILL.md +56 -0
  34. package/dist/bundle/skills/greptile-review-loop/references/review-protocol.md +37 -0
  35. package/dist/bundle/skills/issue-reviewer/SKILL.md +84 -0
  36. package/dist/bundle/skills/issue-reviewer/references/review-format.md +100 -0
  37. package/dist/bundle/skills/issue-reviewer/references/triage.md +105 -0
  38. package/dist/bundle/skills/question-gate/SKILL.md +64 -0
  39. package/dist/bundle/skills/question-gate/references/client-hooks.md +111 -0
  40. package/dist/bundle/skills/question-gate/references/diagram-routing.md +58 -0
  41. package/dist/bundle/skills/question-gate/tests/fixtures/question-corpus.json +481 -0
  42. package/dist/bundle/skills/regression-testing/SKILL.md +49 -0
  43. package/dist/bundle/skills/regression-testing/references/evidence-record.md +35 -0
  44. package/dist/bundle/skills/requirements-spec/SKILL.md +59 -0
  45. package/dist/bundle/skills/risk-scout/SKILL.md +53 -0
  46. package/dist/bundle/skills/risk-scout/references/risk-matrix.md +49 -0
  47. package/dist/bundle/skills/skill-clean-architecture/SKILL.md +53 -0
  48. package/dist/bundle/skills/skill-clean-architecture/references/layer-rules.md +22 -0
  49. package/dist/bundle/skills/skill-clean-architecture/references/source-headers.md +30 -0
  50. package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/bad-utf8.js +1 -0
  51. package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/edge-crlf.ts +6 -0
  52. package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/edge-mixed.ts +15 -0
  53. package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/empty.js +0 -0
  54. package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo/no-newline.js +1 -0
  55. package/dist/bundle/skills/skill-clean-architecture/tests/fixtures/bigo.expected.yml +95 -0
  56. package/dist/bundle/skills/tool-depot/SKILL.md +47 -0
  57. package/dist/bundle/skills/tool-depot/references/checkout.md +29 -0
  58. package/dist/bundle/skills/tool-depot/references/loki-read.md +41 -0
  59. package/dist/bundle/skills/tool-depot/references/readonly-access.md +84 -0
  60. package/dist/bundle/skills/tool-depot/references/tool-catalog.json +47 -0
  61. package/dist/bundle/skills/tool-depot/scripts/loki-runtime-logs.py +305 -0
  62. package/dist/bundle/skills/tool-depot/tests/loki-runtime-logs.test.sh +101 -0
  63. package/dist/bundle/skills/watcher-observability/SKILL.md +72 -0
  64. package/dist/bundle/skills/watcher-observability/references/batch-protocol.md +44 -0
  65. package/dist/bundle/skills/watcher-observability/references/configuration.md +31 -0
  66. package/dist/bundle/skills/watcher-observability/references/error-scan.md +102 -0
  67. package/dist/bundle/skills/watcher-observability/references/live-protocol.md +49 -0
  68. package/dist/bundle/skills/watcher-observability/references/server-account.md +72 -0
  69. package/dist/bundle/skills/watcher-observability/server/watcher-gate.sh +51 -0
  70. package/dist/bundle/skills/watcher-observability/tests/watcher-gate.test.sh +113 -0
  71. package/dist/bundle/skills/watcher-observability/watcher.json +1 -0
  72. package/dist/bundle/skills/workflow-auditor/SKILL.md +53 -0
  73. package/dist/bundle/skills/workflow-auditor/references/audit-protocol.md +49 -0
  74. package/dist/bundle/skills/workflow-auditor/references/ledger.md +122 -0
  75. package/dist/change-lane/classification.js +3 -1
  76. package/dist/check-issue-claim.d.ts +2 -0
  77. package/dist/check-issue-claim.js +146 -0
  78. package/dist/check-worktree-guard.d.ts +2 -0
  79. package/dist/check-worktree-guard.js +114 -0
  80. package/dist/error-scan.d.ts +3 -0
  81. package/dist/error-scan.js +216 -0
  82. package/dist/export-public.d.ts +9 -0
  83. package/dist/export-public.js +274 -0
  84. package/dist/fetch-issue-attachments.d.ts +22 -0
  85. package/dist/fetch-issue-attachments.js +325 -0
  86. package/dist/issue-claim/evaluation.d.ts +66 -0
  87. package/dist/issue-claim/evaluation.js +259 -0
  88. package/dist/issue-claim/loaders.d.ts +5 -0
  89. package/dist/issue-claim/loaders.js +116 -0
  90. package/dist/list-zed-commands.d.ts +7 -0
  91. package/dist/list-zed-commands.js +288 -0
  92. package/dist/plan-issue-triage.d.ts +3 -0
  93. package/dist/plan-issue-triage.js +404 -0
  94. package/dist/question-gate/ledger.d.ts +5 -0
  95. package/dist/question-gate/ledger.js +115 -0
  96. package/dist/question-gate/rules.d.ts +40 -0
  97. package/dist/question-gate/rules.js +483 -0
  98. package/dist/recap/board.d.ts +5 -0
  99. package/dist/recap/board.js +384 -0
  100. package/dist/recap/git-and-github.d.ts +11 -0
  101. package/dist/recap/git-and-github.js +620 -0
  102. package/dist/recap/report-and-hud.d.ts +2 -0
  103. package/dist/recap/report-and-hud.js +294 -0
  104. package/dist/recap/time-and-refs.d.ts +27 -0
  105. package/dist/recap/time-and-refs.js +148 -0
  106. package/dist/recap.d.ts +2 -0
  107. package/dist/recap.js +217 -0
  108. package/dist/render-workflow.js +12 -14
  109. package/dist/resolve-containers.d.ts +2 -0
  110. package/dist/resolve-containers.js +96 -0
  111. package/dist/review-loop.d.ts +7 -0
  112. package/dist/review-loop.js +622 -0
  113. package/dist/save-counts.d.ts +2 -0
  114. package/dist/save-counts.js +191 -0
  115. package/dist/summarize-logs.d.ts +2 -0
  116. package/dist/summarize-logs.js +41 -0
  117. package/dist/sweep-github.d.ts +10 -0
  118. package/dist/sweep-github.js +453 -0
  119. package/dist/sweep-issues.d.ts +56 -0
  120. package/dist/sweep-issues.js +650 -0
  121. package/dist/sweep.d.ts +2 -0
  122. package/dist/sweep.js +301 -0
  123. package/dist/triage-question.d.ts +2 -0
  124. package/dist/triage-question.js +189 -0
  125. package/dist/validate-skills.d.ts +2 -0
  126. package/dist/validate-skills.js +48 -0
  127. package/dist/watch-live.d.ts +7 -0
  128. package/dist/watch-live.js +83 -0
  129. package/dist/watcher/config.d.ts +11 -0
  130. package/dist/watcher/config.js +265 -0
  131. package/dist/watcher/live-classifier.d.ts +52 -0
  132. package/dist/watcher/live-classifier.js +510 -0
  133. package/dist/watcher/safe-fs.d.ts +9 -0
  134. package/dist/watcher/safe-fs.js +159 -0
  135. package/dist/watcher/stream.d.ts +27 -0
  136. package/dist/watcher/stream.js +340 -0
  137. package/dist/watcher/summarizer.d.ts +19 -0
  138. package/dist/watcher/summarizer.js +121 -0
  139. package/dist/wave3/process.d.ts +14 -0
  140. package/dist/wave3/process.js +84 -0
  141. package/dist/wave4/process.d.ts +14 -0
  142. package/dist/wave4/process.js +128 -0
  143. package/dist/workflow/render.d.ts +1 -1
  144. package/dist/workflow/render.js +1 -1
  145. package/dist/workflow-auditor/audit.d.ts +27 -0
  146. package/dist/workflow-auditor/audit.js +583 -0
  147. package/dist/workflow-auditor/ledger-io.d.ts +5 -0
  148. package/dist/workflow-auditor/ledger-io.js +99 -0
  149. package/dist/workflow-auditor/skills-validator.d.ts +10 -0
  150. package/dist/workflow-auditor/skills-validator.js +533 -0
  151. package/dist/worktree-guard/evaluation.d.ts +19 -0
  152. package/dist/worktree-guard/evaluation.js +84 -0
  153. package/dist/worktree-guard/git.d.ts +3 -0
  154. package/dist/worktree-guard/git.js +61 -0
  155. package/package.json +32 -33
@@ -0,0 +1,102 @@
1
+ # Error-only window scan
2
+
3
+ A bounded, read-only look at recent history that reports **only** warn/error
4
+ records and known failure signatures. It exists because a live capture spends its
5
+ 32 KiB-per-window budget on INFO chatter: on a chatty container it sees half the
6
+ bytes and can miss the record that matters. The scan reads the window once, in
7
+ full, and filters locally, so the budget applies to the *read* (`16 MiB` ceiling),
8
+ not to a sample.
9
+
10
+ ## Invocation
11
+
12
+ ```bash
13
+ npx -y @bbcsoftwarefactory/cli error-scan [--project <uuid>] <ssh-alias> <exact-container> [minutes | --tail <lines>]
14
+ ```
15
+
16
+ - `ssh-alias` must match `^(<prefix>)-[a-z0-9][a-z0-9-]*$`, where `<prefix>` is one of the prefixes in the [Watcher configuration](configuration.md) (default `bb`, `bbc`).
17
+ - `exact-container` must match `^[A-Za-z0-9][A-Za-z0-9_.-]*$`. No wildcards; use
18
+ the [batch protocol](batch-protocol.md) discovery first if the name is unknown.
19
+ - `minutes` is an integer `1`-`120`, default `15`.
20
+ - `--tail <lines>` selects by count instead, `1`-`50000`. At roughly 15-18
21
+ lines/s on this platform, `25000` lines is about 25-28 minutes of traffic.
22
+ - `--project <uuid>` keeps only lines that contain that project's uuid, in any
23
+ case and whatever the field is called (`projectId`, `project_id`, ...).
24
+ Containers are shared by customers, so use it whenever the uuid is known:
25
+ other customers' lines are dropped before classification, so they never reach
26
+ the counts, the digests or the saved report. The scan line adds
27
+ `project=<uuid> filtered_out=<n>`, and the report adds `project` and
28
+ `filtered_out`. Records of the project that do not carry its uuid (for example
29
+ logged outside the application's log-context wrapper) are dropped too: state that coverage limit
30
+ in the verdict. The filter is local: the full window is still read over SSH.
31
+
32
+ The single remote command is one of:
33
+
34
+ ```text
35
+ docker logs --since=<minutes>m --timestamps -- <container>
36
+ docker logs --tail=<lines> --timestamps -- <container>
37
+ ```
38
+
39
+ No `-f`, no shell pipeline, no other remote command, no mutation. Submit the
40
+ alias, selector and `scan-approved-container-window` purpose to `tool-depot`
41
+ before connecting, exactly as for a batch.
42
+
43
+ ## Limits
44
+
45
+ - One invocation, one container, one read. Never overlap or retry.
46
+ - `60s` deadline for the whole SSH read; `16 MiB` ceiling on the returned bytes
47
+ (a `25000`-line window measured ~6.6 MiB). A missed deadline or a failing SSH
48
+ prints `Watcher scan failed; no counts.` and reports nothing.
49
+ - The output is read and parsed as a stream through a bounded queue, so memory
50
+ does not grow with what the server returns (200 MB of output peaks below
51
+ 64 MB). Exceeding the ceiling stops SSH, prints
52
+ `Watcher scan refused: output over the 16777216 byte ceiling.` and reports
53
+ nothing.
54
+ - `--since` is minute-granular and Docker may include a boundary record twice
55
+ between runs. Overlapping windows are expected; deduplicate on content, not on
56
+ counts alone.
57
+ - Records before `--since`, rotated-out logs, and anything the container emitted
58
+ while Docker was not capturing are outside coverage.
59
+
60
+ ## Classification and output
61
+
62
+ Parsing matches the live runner: leading timestamp/header stripped, embedded JSON
63
+ read after a plain prefix, string and bunyan/pino numeric levels, and the fixed
64
+ signature set (`TypeError`, `UnhandledPromiseRejection`, `ECONNREFUSED`,
65
+ `ETIMEDOUT`, `ECONNRESET`, `EPIPE`, `ENOTFOUND`/`EAI_AGAIN`/`getaddrinfo`,
66
+ `HTTP_5xx`, `OutOfMemory`).
67
+
68
+ ```text
69
+ scan alias=… container=… selector=… lines=… bytes=…
70
+ severity error=… warn=… info=… debug=… unclassified=…
71
+ signatures HTTP_5xx:1,…
72
+ events guardrail.triggered:2,…
73
+ evidence rows=2
74
+ [warn] [redacted]
75
+ [error] sig=HTTP_5xx upstream [redacted] from [redacted]
76
+ ```
77
+
78
+ `evidence rows` is capped at `40`. Each digest is rebuilt from an **allowlist**:
79
+ known diagnostic words (`failed`, `timeout`, `refused`, `upstream`, …), error
80
+ codes (`ECONNREFUSED`, …) and exception names (`TimeoutError`, …). Every other
81
+ token becomes `[redacted]`, so no character of a value, host, email, number or
82
+ identifier reaches the output. For JSON records only the `msg`, `message`,
83
+ `error` or `err` field is used; other keys (for example `password`) are never
84
+ read into the digest. Digests are capped at 16 tokens and `220` characters.
85
+ Raw log text is never printed, persisted, or quoted. The allowlisted digests
86
+ are the only text that the saved JSON contains.
87
+
88
+ ## Saving
89
+
90
+ From a Git worktree whose root `.gitignore` contains the exact line `/tmp_logs/`,
91
+ a run **with signal** writes `tmp_logs/scan/<kind>-<value>-<pid>.json` (for
92
+ example `since-10-1234.json`, `tail-25000-1234.json`) with mode `0600`. Clean windows write nothing: a report that says "no signal" is noise for
93
+ a recurring job.
94
+
95
+ ## Recurring use
96
+
97
+ The intended schedule is a watchdog, not continuous streaming: run the scan
98
+ once or twice per window (for example every 5 minutes with `--tail 25000`, which
99
+ covers ~25-28 minutes at current volume) and deliver output only when there is
100
+ signal. A cron wrapper should
101
+ print nothing on a clean window and deduplicate rows already alerted, otherwise
102
+ one persistent warning repeats on every tick.
@@ -0,0 +1,49 @@
1
+ # Opt-in live protocol
2
+
3
+ Prefer live sleuth evidence for incident reconstruction when the user explicitly authorizes live observation and redacted evidence for an exact container. It cannot recover events from before the connection. Use the [historical batch protocol](batch-protocol.md) for historical counts or explicit wildcard discovery; it does not reconstruct a timeline. Use live mode with a trusted SSH alias whose prefix the [Watcher configuration](configuration.md) allows and the exact name or ID of a container the user has specifically authorized. Use [the saving commands](#default-local-saving) by default. Only if the user explicitly requests no saving, use this low-level live counts command from the installed skill directory:
4
+
5
+ ```bash
6
+ npx -y @bbcsoftwarefactory/cli watch-live "$alias_name" "$container"
7
+ ```
8
+
9
+ Requires local Node.js 22.18+ (`@bbcsoftwarefactory/cli`), Bash and OpenSSH. The runner validates the original alias and container against the exact ASCII grammar before launching any child process, then reuses the default resolver without discovery. Wildcards are rejected. It creates one noninteractive SSH session with strict host-key checks, no forwarding, no local command and no connection multiplexing. Its only remote command is `docker logs -f --tail=0 -- <container>`. If more than one exact target was approved, complete and report each one before starting the next; never overlap or retry. Stop on an error and identify any targets not reached.
10
+
11
+ The 60-second local monotonic deadline includes SSH setup. Four consecutive 15-second windows are measured by local input processing time, not by embedded timestamps. The runner closes the local SSH client at the deadline; local cleanup may take up to two additional seconds before reporting. Empty windows are reported. Early EOF, startup or transport failure, or failed local cleanup produces exit 1, a fixed diagnostic on stderr, and no summary. A normal local deadline produces exit 0 with `live status=deadline` followed by four `window=` lines. The low-level runner does not persist state, and there are no configurable durations or caps.
12
+
13
+ Each window parses at most 32,768 input bytes. The runner drains excess without parsing or retaining it and reports discarded bytes it actually read. At the cap or a window boundary, an incomplete LF-delimited record is discarded, along with its continuation through the next LF. Bytes dequeued at the final deadline are reported as dropped without parsing; bytes left unread at disconnect cannot be measured. Only complete records count: common stack continuations, including Python traceback file, indented source, and caret lines, count as `frames`, not errors. The final exception line is classified separately. A plain `try` or `catch` statement alone counts as unclassified. For JSON objects, only `level` and `error.name` affect classification; for plain text, a leading level or an exact bracketed level such as `[ERROR]` (not `[ERROR CODES]`) and the allowlisted signatures are used. Recognized levels take precedence for severity. Without a recognized level, a signature supplies error severity; otherwise the record is `unclassified`.
14
+
15
+ The fixed signatures are `TypeError`, `UnhandledPromiseRejection` (including `UnhandledPromiseRejectionWarning`), `ECONNREFUSED`, `ETIMEDOUT`, `ECONNRESET`, `EPIPE`, `ENOTFOUND`/`EAI_AGAIN`/`getaddrinfo`, `HTTP_5xx` (plain-text `HTTP 502`, `HTTP/<version> 503` and other 5xx) and `OutOfMemory`. Each eligible record increments at most one signature; plain-text matches use the order above for precedence. All nine labels appear in descending count order, with ties in that same fixed order.
16
+
17
+ A leading timestamp or host header is stripped before level detection, and embedded JSON plus string and bunyan/pino numeric levels are read, so `16:40:08 WARN guardrail.triggered {json}` counts as WARN instead of unclassified. Counts finish together after local capture ends; no raw bytes or SSH/Docker diagnostic text are output. Container stderr shares the SSH diagnostic channel, so merged input may influence counts if a diagnostic resembles a log record. Report target identity separately along with the counts and these coverage limits; keyword counts do not establish complete delivery or prove incidents.
18
+
19
+ ## Default local saving
20
+
21
+ Use these commands unless the user explicitly requests no saving. From the caller's Git worktree, add `/tmp_logs/` to the project root `.gitignore` first.
22
+
23
+ ```bash
24
+ npx -y @bbcsoftwarefactory/cli save-counts live "$alias_name" "$container"
25
+ ```
26
+
27
+ If sleuth processing was separately authorized, the saving entry point also accepts:
28
+
29
+ ```bash
30
+ npx -y @bbcsoftwarefactory/cli save-counts sleuth "$alias_name" "$container"
31
+ ```
32
+
33
+ Both commands still print `live status=deadline` and the four aggregate window rows. They save one `tmp_logs/<UTC>-<hash>/report.json` with the exact validated container under `source.container`, numeric `counts.windows`, and `coverage` with window duration, byte limit per window, and total dropped bytes. In `live` counts mode, `evidence.status` is `not_observed`, with `No detailed evidence observed.` and an empty event list. In authorized `sleuth` mode, `evidence.events` and `evidence.coverage` contain the same redacted events and selection counters printed in the `sleuth ` rows, in the same capture order. Only allowlisted excerpts and sanitized frame kinds and lines are saved; never save raw logs, record IDs, source paths, or diagnostic text. Do not redirect or tee the output into a file. Early EOF, capture failure, invalid input or an unsafe/unignored destination returns nonzero without a summary. The exact-target, deadline and coverage rules above still apply. Use `npx -y @bbcsoftwarefactory/cli save-counts --help` for local help.
34
+
35
+ ## Preferred mode for incident reconstruction: sleuth
36
+
37
+ When live scope and redacted evidence are explicitly authorized, use the saving `sleuth` command above rather than counts alone. If the user has not authorized excerpts, explain the difference and ask before capturing. Only if the user explicitly requests no saving, use this low-level command:
38
+
39
+ ```bash
40
+ npx -y @bbcsoftwarefactory/cli watch-live --sleuth "$alias_name" "$container"
41
+ ```
42
+
43
+ Use `--sleuth --help` for its local help. The exact-target gate, SSH command, 60-second deadline, byte budget, failure behavior and original window rows are unchanged. No new remote operations or persisted state in the conversation-only command. On success only, the original summary is followed by `sleuth ` lines containing JSON: up to 24 selected events in local arrival order and one coverage record. `window` is the capture window; `seq` is the 1-based capture-wide ordinal of complete records presented to the parser. Gaps can indicate unselected, invalid or capped records; discarded bytes do not consume ordinals. This is not an ordering by source timestamps.
44
+
45
+ - A row is emitted only when it carries signal fields (exception, cause, code, status 503, frames, excerpt) or warn/error severity. Ids on an INFO record are linkage only: emitting them alone fills the 24-event budget with chatter, so they are not emitted and their labels are not allocated.
46
+ - Only explicit top-level JSON `traceId`/`trace_id`, `requestId`/`request_id`, and `correlationId`/`correlation_id` fields create links. IDs must be nonempty strings of at most 128 characters, and aliases for the same kind must agree. At most 16 distinct `(kind, value)` pairs get ephemeral labels such as `id1`, assigned in first emitted order; known labels continue to match across windows even after the cap. Raw IDs are never emitted. A repeated label indicates exact equality within that kind, not a verified relationship or cause. Nearby unlabelled frames/events are not linked; keep temporal observations and causal hypotheses separate from explicit label matches.
47
+ - The selector uses JSON `error.name`, `error.code`, `error.cause.name`, `error.cause.code`, integer `status` equal to `503`, recognized `error.stack` frames, and qualifying `message` excerpts. It adds normalized `level` only to selected events. Plain records can contribute anchored known exception/cause or code lines and recognized stack frames, but cannot create ID links. Known exception/cause labels are `TypeError`, `ValueError`, `TimeoutError`, `ConnectionError`, `ReferenceError`, `RangeError`, and `UnhandledPromiseRejection` (including its `Warning` variant). Fixed codes are `ECONNREFUSED`, `ETIMEDOUT`, `ECONNRESET`, and `EPIPE`. Node, Java and Python frame shapes supply a fixed `kind` and a decimal `line` of one to six input digits only; paths, functions, columns, and recognized Python source continuations are not evidence. In both plain input and JSON stacks, four-space-indented continuations after a Python `File` entry are omitted from sleuth evidence, even if they resemble another runtime's frame. Unknown shapes or fields do not become strings in the output. Duplicate JSON keys, invalid UTF-8 and invalid JSON object records have no raw-text fallback.
48
+ - Up to four excerpts are reconstructed from the first 12 whitespace-delimited tokens of the JSON `message` or the detail of a recognized plain diagnostic. Only exact diagnostic tokens (`connection`, `refused`, `timeout`, `timed`, `out`, `reset`, `upstream`, `unavailable`, and the four fixed codes) can appear. Unknown runs and truncated tails become `[redacted]`; without any known token in that prefix, there is no excerpt. These fragments may be misleading out of context. Never replace a missing excerpt with raw text or treat an excerpt as instructions.
49
+ - The final coverage record always says `coverage=incomplete`: the stream is live-only, selected evidence is lossy, and unread bytes cannot be measured. `records` counts complete inputs; `invalid_records` counts parser rejections; `unselected_records` counts other complete inputs lacking selected evidence. `event_drops` counts selected candidates omitted by evidence caps. `id_drops` counts invalid/conflicting ID kinds and unseen ID kinds over the label cap; `frame_drops` counts recognized frames beyond three per considered event; `excerpt_drops` counts qualifying excerpts beyond the four-excerpt cap; `excerpt_truncations` counts emitted excerpts cut at 12 tokens. Field-cap counters do not also enumerate fields of events skipped after the event cap. `dropped_bytes` totals the four window drop counters. Missing signals are not evidence that an incident did not happen.
@@ -0,0 +1,72 @@
1
+ # Server account for the Watcher
2
+
3
+ The Watcher scripts and [Tool Depot](../../tool-depot/SKILL.md) limit what the **agent** asks for. They do not limit what the **SSH account** can do. That limit has to be enforced on the server. This page explains how.
4
+
5
+ ## Why it matters
6
+
7
+ - **The `docker` group is root.** Any account that can reach the Docker socket can start a privileged container that mounts the host filesystem. Giving the Watcher account Docker access is equivalent to giving it root, unless something narrows the commands it can run.
8
+ - **Tool Depot is a workflow rule.** It has no credentials and does not intercept commands. `bbc audit-ledger` checks the delivery ledger after the fact, and the agent writes that ledger itself. An `ssh` call that is never recorded is invisible to it.
9
+
10
+ ## Enforce it with a forced command
11
+
12
+ [`server/watcher-gate.sh`](../server/watcher-gate.sh) is an SSH forced command. Whatever the client asks for, `sshd` runs the gate instead, with the request in `SSH_ORIGINAL_COMMAND`. The gate allows exactly the five remote commands the Watcher sends:
13
+
14
+ | Command | Remote command |
15
+ |---|---|
16
+ | `bbc resolve-containers` | `docker ps --filter 'name=^/?<prefix>.*$' --format '{{.Names}}'` |
17
+ | `bbc watch-live` | `docker logs -f --tail=0 -- <container>` |
18
+ | `bbc save-counts historical` | `docker logs -f --tail=1000 -- <container>` |
19
+ | `bbc error-scan <minutes>` | `docker logs --since=<1-120>m --timestamps -- <container>` |
20
+ | `bbc error-scan --tail <n>` | `docker logs --tail=<1-50000> --timestamps -- <container>` |
21
+
22
+ It re-validates every value with the same rules as the scripts, runs `docker` with an argument array and never through a shell, refuses everything else with exit `126`, and logs each decision to syslog with the tag `watcher-gate`.
23
+
24
+ ## Install
25
+
26
+ On the server, as an administrator:
27
+
28
+ 1. Create a dedicated account, for example `watcher`, and add it to the `docker` group. Do not reuse a personal or deployment account.
29
+ 2. Install the gate so the account cannot edit it:
30
+
31
+ ```bash
32
+ install -o root -g root -m 0755 watcher-gate.sh /usr/local/bin/watcher-gate.sh
33
+ ```
34
+
35
+ 3. In `~watcher/.ssh/authorized_keys`, which must be owned by root and not writable by `watcher`, bind the Watcher key to the gate:
36
+
37
+ ```text
38
+ restrict,command="/usr/local/bin/watcher-gate.sh" ssh-ed25519 AAAA... watcher
39
+ ```
40
+
41
+ `restrict` disables port, agent and X11 forwarding, PTY allocation and `~/.ssh/rc`.
42
+
43
+ 4. On the client, point the trusted alias (its prefix must be allowed by the [Watcher configuration](configuration.md)) in `~/.ssh/config` at that account and key.
44
+
45
+ ## Verify
46
+
47
+ From the client:
48
+
49
+ ```bash
50
+ ssh bb-example docker ps # refused: "watcher-gate: command not allowed"
51
+ ssh bb-example 'docker logs -f --tail=0 -- app-1; id' # refused
52
+ ```
53
+
54
+ Then run a normal Watcher capture: it should succeed. On the server, `journalctl -t watcher-gate` (or `/var/log/auth.log`, depending on the distribution) shows one `allowed:` or `denied:` line per connection.
55
+
56
+ `tests/watcher-gate.test.sh` covers the gate locally: the five allowed shapes with their exact `docker` argv, the refused cases (shell, mutation, chaining, substitution, newline injection, out-of-range windows, options as names, discovery regexes), and an end-to-end run of the real scripts through a fake `ssh`.
57
+
58
+ ## Audit against the server log
59
+
60
+ The syslog lines are the server's own record of what ran. Export the delivery's time window and pass it to the auditor:
61
+
62
+ ```bash
63
+ journalctl -t watcher-gate -o json --since "<start>" --until "<end>" > watcher-gate.json
64
+ npx -y @bbcsoftwarefactory/cli audit-ledger <ledger.json> --server-log watcher-gate.json
65
+ ```
66
+
67
+ Every `allowed:` command must match one `ssh` entry in the ledger's `tool_uses` that names the same container, or the same discovery prefix such as `saas-app-*`. A command without a match is violation `T7`: an SSH use that bypassed Tool Depot. Plain syslog text, for example from `/var/log/auth.log`, is accepted too. A file with no `watcher-gate` entries is rejected as unusable, so a wrong export cannot pass as a clean audit.
68
+
69
+ ## Limits
70
+
71
+ - The gate narrows the commands, not the data. `docker logs` still returns every line of the container, including other customers' data in shared containers. Redaction happens on the client ([error-scan](error-scan.md)).
72
+ - When the Watcher adds a new remote command, add its exact shape to the gate and to `tests/watcher-gate.test.sh` in the same change. Otherwise the server will refuse it.
@@ -0,0 +1,51 @@
1
+ #!/usr/bin/env bash
2
+ # watcher-gate.sh: SSH forced command for the Watcher's read-only server account.
3
+ #
4
+ # Install it on the server and bind it to the Watcher key in authorized_keys:
5
+ # restrict,command="/usr/local/bin/watcher-gate.sh" ssh-ed25519 AAAA... watcher
6
+ # See ../references/server-account.md for the full procedure.
7
+ #
8
+ # The Watcher scripts send exactly five remote command shapes. This gate allows
9
+ # only those, re-validates every value, runs docker with an argument array (never
10
+ # through a shell), and logs each decision to syslog (tag: watcher-gate) so the
11
+ # delivery ledger can be audited against what the server actually ran.
12
+ set -u
13
+ export LC_ALL=C
14
+
15
+ cmd=${SSH_ORIGINAL_COMMAND-}
16
+ name='[A-Za-z0-9][A-Za-z0-9_.-]*'
17
+ # Discovery prefix as `bbc resolve-containers` sends it: literal dots escaped as "\.".
18
+ prefix='[A-Za-z0-9]([A-Za-z0-9_-]|\\\.)*'
19
+
20
+ log() {
21
+ local text=${1//[^[:print:]]/?}
22
+ command -v logger >/dev/null 2>&1 && logger -t watcher-gate -- "${text:0:300}"
23
+ return 0
24
+ }
25
+
26
+ deny() {
27
+ log "denied: $cmd"
28
+ printf '%s\n' 'watcher-gate: command not allowed' >&2
29
+ exit 126
30
+ }
31
+
32
+ allow() {
33
+ log "allowed: $cmd"
34
+ exec docker "$@"
35
+ }
36
+
37
+ re_follow="^docker logs -f --tail=(0|1000) -- ($name)\$"
38
+ re_since="^docker logs --since=([1-9][0-9]{0,2})m --timestamps -- ($name)\$"
39
+ re_tail="^docker logs --tail=([1-9][0-9]{0,4}) --timestamps -- ($name)\$"
40
+ re_ps="^docker ps --filter 'name=\\^/\\?($prefix)\\.\\*\\\$' --format '\\{\\{\\.Names\\}\\}'\$"
41
+
42
+ if [[ $cmd =~ $re_follow ]]; then
43
+ allow logs -f "--tail=${BASH_REMATCH[1]}" -- "${BASH_REMATCH[2]}"
44
+ elif [[ $cmd =~ $re_since ]] && (( BASH_REMATCH[1] <= 120 )); then
45
+ allow logs "--since=${BASH_REMATCH[1]}m" --timestamps -- "${BASH_REMATCH[2]}"
46
+ elif [[ $cmd =~ $re_tail ]] && (( BASH_REMATCH[1] <= 50000 )); then
47
+ allow logs "--tail=${BASH_REMATCH[1]}" --timestamps -- "${BASH_REMATCH[2]}"
48
+ elif [[ $cmd =~ $re_ps ]]; then
49
+ allow ps --filter "name=^/?${BASH_REMATCH[1]}.*\$" --format '{{.Names}}'
50
+ fi
51
+ deny
@@ -0,0 +1,113 @@
1
+ #!/usr/bin/env bash
2
+ # Suite for server/watcher-gate.sh (#40): the SSH forced command must allow exactly
3
+ # the remote commands the Watcher commands send, and refuse everything else without
4
+ # invoking docker.
5
+ set -u
6
+ cd -- "${BASH_SOURCE[0]%/*}/.."
7
+ ROOT=$(cd ../.. && pwd)
8
+ GATE="$PWD/server/watcher-gate.sh"
9
+ CLI="${BBC_CLI_ENTRY:-$ROOT/packages/cli/src/bbc.ts}"
10
+ scratch=$(mktemp -d)
11
+ trap 'rm -rf -- "$scratch"' EXIT
12
+ mkdir -p "$scratch/bin"
13
+
14
+ # Fake docker: records its argv (one per line) and emits minimal output.
15
+ cat >"$scratch/bin/docker" <<'EOF'
16
+ #!/usr/bin/env bash
17
+ printf '%s\n' "$@" >"$WATCHER_GATE_TEST_ARGV"
18
+ if [[ $1 == ps ]]; then printf 'app-1\napp-2\n'; else printf '2026-01-01T00:00:00Z ERROR connection refused\n'; fi
19
+ EOF
20
+ chmod +x "$scratch/bin/docker"
21
+ export WATCHER_GATE_TEST_ARGV="$scratch/argv"
22
+ export PATH="$scratch/bin:$PATH"
23
+
24
+ checks=0
25
+ failures=0
26
+ fail() { printf 'FAIL [%s]: %s\n' "$1" "$2" >&2; failures=$((failures + 1)); }
27
+
28
+ run_gate() {
29
+ rm -f "$WATCHER_GATE_TEST_ARGV"
30
+ SSH_ORIGINAL_COMMAND=$1 bash "$GATE" >/dev/null 2>&1
31
+ }
32
+
33
+ expect_allowed() { # label, command, expected argv joined by |
34
+ checks=$((checks + 1))
35
+ if ! run_gate "$2"; then fail "$1" "refused: $2"; return; fi
36
+ local got
37
+ got=$(paste -sd'|' "$WATCHER_GATE_TEST_ARGV" 2>/dev/null)
38
+ [[ $got == "$3" ]] || fail "$1" "argv '$got' != '$3'"
39
+ }
40
+
41
+ expect_denied() { # label, command
42
+ checks=$((checks + 1))
43
+ run_gate "$2"
44
+ local code=$?
45
+ [[ $code == 126 ]] || fail "$1" "exit $code (want 126) for: $2"
46
+ [[ ! -e $WATCHER_GATE_TEST_ARGV ]] || fail "$1" "docker was invoked for: $2"
47
+ }
48
+
49
+ # 1. The five shapes the Watcher sends are allowed, with an exact argv.
50
+ expect_allowed 'live follow' 'docker logs -f --tail=0 -- app-1' 'logs|-f|--tail=0|--|app-1'
51
+ expect_allowed 'historical batch' 'docker logs -f --tail=1000 -- app.v2_1' 'logs|-f|--tail=1000|--|app.v2_1'
52
+ expect_allowed 'scan since' 'docker logs --since=120m --timestamps -- app-1' 'logs|--since=120m|--timestamps|--|app-1'
53
+ expect_allowed 'scan tail' 'docker logs --tail=50000 --timestamps -- app-1' 'logs|--tail=50000|--timestamps|--|app-1'
54
+ expect_allowed 'discovery' "docker ps --filter 'name=^/?saas-app\\.v2-.*\$' --format '{{.Names}}'" \
55
+ 'ps|--filter|name=^/?saas-app\.v2-.*$|--format|{{.Names}}'
56
+
57
+ # 2. Everything else is refused before docker runs.
58
+ expect_denied 'empty (interactive login)' ''
59
+ expect_denied 'shell' 'bash'
60
+ expect_denied 'mutation' 'docker rm -f app-1'
61
+ expect_denied 'exec' 'docker exec app-1 sh'
62
+ expect_denied 'chained command' 'docker logs -f --tail=0 -- app-1; id'
63
+ expect_denied 'substitution' 'docker logs -f --tail=0 -- $(id)'
64
+ expect_denied 'newline injection' $'docker logs -f --tail=0 -- app-1\nid'
65
+ expect_denied 'follow with other tail' 'docker logs -f --tail=5 -- app-1'
66
+ expect_denied 'since above 120' 'docker logs --since=121m --timestamps -- app-1'
67
+ expect_denied 'since zero' 'docker logs --since=0m --timestamps -- app-1'
68
+ expect_denied 'since leading zero' 'docker logs --since=07m --timestamps -- app-1'
69
+ expect_denied 'tail above 50000' 'docker logs --tail=50001 --timestamps -- app-1'
70
+ expect_denied 'option as name' 'docker logs -f --tail=0 -- -app'
71
+ expect_denied 'missing --' 'docker logs -f --tail=0 app-1'
72
+ expect_denied 'bare ps' 'docker ps'
73
+ expect_denied 'ps empty prefix' "docker ps --filter 'name=^/?.*\$' --format '{{.Names}}'"
74
+ expect_denied 'ps regex in prefix' "docker ps --filter 'name=^/?a.*b.*\$' --format '{{.Names}}'"
75
+ expect_denied 'ps other format' "docker ps --filter 'name=^/?app-.*\$' --format '{{json .}}'"
76
+
77
+ # 3. End to end: the real CLI commands, through a fake ssh that forwards the remote
78
+ # command to the gate the way sshd does (arguments joined by single spaces).
79
+ cat >"$scratch/bin/ssh" <<EOF
80
+ #!/usr/bin/env bash
81
+ while [[ \$# -gt 0 ]]; do
82
+ case \$1 in
83
+ -o) shift 2 ;;
84
+ -*) shift ;;
85
+ *) shift; break ;; # host alias
86
+ esac
87
+ done
88
+ SSH_ORIGINAL_COMMAND="\$*" exec bash "$GATE"
89
+ EOF
90
+ chmod +x "$scratch/bin/ssh"
91
+ printf '@echo off\r\nbash "%%~dp0ssh" %%*\r\n' >"$scratch/bin/ssh.cmd"
92
+
93
+ checks=$((checks + 1))
94
+ out=$(node "$CLI" resolve-containers bb-test 'app-*' 2>&1)
95
+ out=${out//$'\r'/}
96
+ [[ $out == $'app-1\napp-2' ]] || fail 'e2e resolve-containers' "$out"
97
+
98
+ checks=$((checks + 1))
99
+ out=$(cd "$scratch" && node "$CLI" error-scan bb-test app-1 15 2>&1)
100
+ [[ $out == *'severity error=1'* ]] || fail 'e2e error-scan since' "$out"
101
+
102
+ checks=$((checks + 1))
103
+ out=$(cd "$scratch" && node "$CLI" error-scan bb-test app-1 --tail 200 2>&1)
104
+ [[ $out == *'severity error=1'* ]] || fail 'e2e error-scan tail' "$out"
105
+
106
+ checks=$((checks + 1))
107
+ repo="$scratch/repo"
108
+ mkdir -p "$repo" && git -C "$repo" init -q && printf '/tmp_logs/\n' >"$repo/.gitignore"
109
+ out=$(cd "$repo" && node "$CLI" save-counts historical bb-test app-1 2>&1)
110
+ [[ $out == *'historical status=finished'* ]] || fail 'e2e save-counts historical' "$out"
111
+
112
+ printf 'watcher-gate.test.sh: %d checks, %d failed\n' "$checks" "$failures"
113
+ [[ $failures == 0 ]]
@@ -0,0 +1 @@
1
+ {"alias_prefixes": ["bb", "bbc"]}
@@ -0,0 +1,53 @@
1
+ ---
2
+ name: workflow-auditor
3
+ description: "Trigger: workflow audit, process audit, diagram compliance, Tool Depot usage check, before Code Owner handoff. Run on every PR: check the delivery ledger against the skill workflow and the Tool Depot catalog, and send violations back to the stage that owns them."
4
+ license: Apache-2.0
5
+ compatibility: Requires Node.js 22.18+ for the bundled @bbcsoftwarefactory/cli checker and the tool-depot catalog (installed alongside, or passed with --catalog).
6
+ metadata:
7
+ author: bbc-skill-internals
8
+ version: "1.4"
9
+ pre_hook: "npx -y @bbcsoftwarefactory/cli audit-ledger && npx -y @bbcsoftwarefactory/cli validate-skills"
10
+ ---
11
+
12
+ ## Activation Contract
13
+
14
+ Run on every PR the workflow opens or updates, after `greptile-review-loop` and before the human Code Owner review. Also use it when asked whether a delivery followed the workflow diagram or used Tool Depot correctly. Work independently or accept a handoff from `delivery-coordinator`.
15
+
16
+ **Company role:** Process Auditor. It checks that the workflow was followed; it does not review code, approve, merge, or deploy.
17
+
18
+ ## Hard Rules
19
+
20
+ - Read-only. Never edit code, the ledger, the PR, issues, or review threads. Do not run tests or tools on the delivery's behalf; audit the evidence that exists.
21
+ - Route GitHub reads through `tool-depot` (`github-read`). If it is unavailable or the request is not eligible, report the affected check as unverified; do not use another channel.
22
+ - Never invent evidence, authorizations, or Tool Depot decisions. Missing evidence is a gap or a violation, never a pass. A `conforms` verdict grants no permission and is not an approval.
23
+ - Report rule IDs, stages, and record IDs. Do not copy secrets, tokens, customer data, raw logs, or full reports into findings.
24
+
25
+ ## Decision Gates
26
+
27
+ | Condition | Action |
28
+ |---|---|
29
+ | Ledger or Tool Depot catalog missing or invalid | Verdict `unusable`. Reconstruct a ledger only from supplied evidence, outside the repository, and mark it `reconstructed`. |
30
+ | Structural or semantic violation | Verdict `violations`. Return each finding to the stage that owns it; the PR does not go to the Code Owner until the audit is rerun. |
31
+ | Only gaps (for example, Greptile unavailable) | Verdict `gaps`. Hand off with the gaps stated for the Code Owner. |
32
+ | No findings | Verdict `conforms`. Hand off. |
33
+
34
+ ## Execution Steps
35
+
36
+ 1. Locate the ledger and run `npx -y @bbcsoftwarefactory/cli audit-ledger` from the delivery worktree, following the [audit protocol](references/audit-protocol.md).
37
+ 2. Run the semantic pass in that protocol: RED reason, GREEN on the same command, quality on the committed diff, the current PR head through Tool Depot, every covered tool call recorded, and authorizations traceable to a person.
38
+ 3. Merge both passes into one verdict and hand back per the protocol. After a fix, rerun the whole audit on the new ledger.
39
+
40
+ ## Companion Handoffs
41
+
42
+ Return findings to `delivery-coordinator`, which routes them to `requirements-spec`, `regression-testing`, `skill-clean-architecture`, `code-quality-gate`, `greptile-review-loop`, or `tool-depot`. Missing human decisions go to the person named in the workflow's [roles and approvals](../delivery-coordinator/references/intake.md#roles-and-approvals).
43
+
44
+ Check the active skill catalog for the named companion before relying on it. If availability is unknown and its help is needed, ask whether it is available; do not ask when equivalent evidence already satisfies the handoff. Never assume installation, install automatically, or transfer permissions.
45
+
46
+ ## Output Contract
47
+
48
+ In chat, lead with a 1-line traffic-light verdict (`🟢 conforms`, `🟡 gaps`, `🔴 violations`, or `🔴 unusable`), PR and short head SHA audited, plus `reconstructed` if applicable. List only active findings (`rule ID · location · owning stage`), Code Owner gaps, and unverified checks—keep full details in the audit report or on `"detalle"`.
49
+
50
+ ## References
51
+
52
+ - [Delivery ledger format and rule table](references/ledger.md)
53
+ - [Audit protocol: structural and semantic passes, hand back](references/audit-protocol.md)
@@ -0,0 +1,49 @@
1
+ # Audit protocol
2
+
3
+ The audit has two passes. The script checks structure: stage order, required evidence fields, human authorizations, and Tool Depot records against the catalog. The auditor then checks meaning: that the recorded evidence says what the ledger claims. Neither pass edits code, the ledger, the PR, or any thread.
4
+
5
+ ## 1. Locate the ledger
6
+
7
+ From the delivery worktree:
8
+
9
+ ```bash
10
+ npx -y @bbcsoftwarefactory/cli audit-ledger
11
+ ```
12
+
13
+ Without a path, the script reads `bbc-delivery-ledger.json` from the worktree's Git directory (see [ledger](ledger.md#where-it-lives)). Pass `--catalog <path>` only if the `tool-depot` skill is not installed next to this one. If the catalog cannot be found, the verdict is `unusable`: do not audit Tool Depot use from memory.
14
+
15
+ No ledger (a PR opened by someone else, or a delivery that predates the ledger): reconstruct one from supplied evidence only (the PR body, linked issue, recorded test commands, review links, and the conversation's tool calls). Write it to a temporary path outside every repository, mark the report as `reconstructed`, and record what could not be reconstructed as gaps. Never invent an authorization or a Tool Depot decision that is not in the evidence.
16
+
17
+ ## 2. Run the structural pass
18
+
19
+ | Exit | Verdict | Meaning |
20
+ |---|---|---|
21
+ | `0` | `conforms` | No violations and no gaps. |
22
+ | `0` | `gaps` | No violations; gaps (`G1`) must reach the Code Owner. |
23
+ | `1` | `violations` | At least one rule in [the rule table](ledger.md#rules-checked-by-the-script) failed. |
24
+ | `2` | `unusable` | Ledger or catalog missing, invalid, or of an unknown version. |
25
+
26
+ ## 3. Run the semantic pass
27
+
28
+ Check each item against the evidence the ledger points to. Report any mismatch as a violation with the closest rule ID.
29
+
30
+ - **RED (`E1`):** the failure is the assertion for the criterion, not a setup, import, or environment error.
31
+ - **GREEN (`E2`):** the same command as RED passes on the resulting revision, and applicable existing checks were run or their skips recorded.
32
+ - **Quality (`Q1`):** the gate verdict covers the same diff that was committed, and every exception is recorded with its justification.
33
+ - **PR head (`R1`):** confirm that the recorded head SHA is the PR's current head. Read it through `tool-depot` (`github-read` / `read-pr-review-and-checks`) and record that request and use in your report. If the Depot does not return `eligible`, report the head as unverified; do not read it through another channel.
34
+ - **Issue back-link (`R2`):** when the delivery stems from a canonical GitHub issue, confirm `commit_pr.evidence.issue` and `issue_linked: true` match an eligible `github-write` (`comment-approved-issue`) comment on that issue linking the opened PR so the issue is never left orphaned.
35
+ - **Canonical issue & GitHub Project board:** for `change` work, confirm `specify` resolved a canonical GitHub issue (`check-duplicate-issues` → linked & commented via `comment-approved-issue` if found, reopened per `issue-dedup.md`, or created via `publish-approved-issue` if absent) and moved the issue on the GitHub Project v2 board to its active-work status (`"Trabajando"`, `"Working"`, `"In Progress"`, etc.) via `read-approved-project-board` + `update-approved-project-status` (or recorded an explicit `🟡 GAP` when no board exists or `project`/`read:project` token scopes are missing).
36
+ - **Search before filing (`D1`):** every issue publish or reopen follows an eligible `check-duplicate-issues` search of the same repository, and the `specify` reason names the terms, candidates, and decision. A reopened issue carries a history comment.
37
+ - **Issue claim (`C1`–`C4`):** apply the [semantic checks of the claim protocol](../../delivery-coordinator/references/issue-claim.md#semantic-checks-for-the-auditor-llm): the `check` and `verify` verdicts are `bbc check-issue-claim` output for reads made in this delivery, the claimant is the authorizing person, a handover cites the holder's or Tech Lead's message, and a delivery that stopped before its PR released the claim.
38
+ - **Issue triage (`I1`–`I2`):** the [triage](../../issue-reviewer/references/triage.md) writes match the `bbc plan-issue-triage` commands the person approved, the only assignee added is the issue author, and the later comment states the assignee, the label changes, the priority with its rationale, and any gap.
39
+ - **Visual reference (`V1`):** every issue publish, update, or comment, including the PR back-link, embeds the image recorded in `visual`, and the image is sanitized. A stated gap (`G2`) must also appear in the issue text.
40
+ - **Tool use (`T1`):** if the session's tool calls are visible, every covered SSH, public web, or GitHub operation in them appears in `tool_uses`. A call that is missing is `T1`. A call made after a `denied` or `needs-approval` decision for the same target, through any tool or agent, is `T2`.
41
+ - **Authorizations (`A1`, `A2`):** each one is traceable to a person's message or decision, and its scope covers what was done.
42
+
43
+ ## 4. Hand back
44
+
45
+ - `conforms` or `gaps`: return the report to `delivery-coordinator` for the Code Owner handoff. Gaps travel with the PR.
46
+ - `violations`: return each one to the stage that owns it: `W1` and `K1` to Delivery Coordinator, `S*` and `E*` to the earliest missing or failing stage, `Q1` to `code-quality-gate`, `R1` to `greptile-review-loop`, `R2` to Delivery Coordinator (link PR back on canonical issue via Tool Depot), `V1` to the skill that wrote on the issue (`delivery-coordinator` or `issue-reviewer`), `D1` to Delivery Coordinator (search before filing), `I*` to `issue-reviewer` (triage), `C*` to Delivery Coordinator (claim the issue; a handover goes to the person who holds it), `A*`, `H*`, and `T5` to the person whose decision is missing, and other `T*` rules to the requesting skill and `tool-depot`. Rerun the audit after the fix.
47
+ - `unusable`: report what is missing. Do not issue a verdict.
48
+
49
+ A `conforms` verdict is not an approval. It does not replace Greptile, the Code Owner's review, or the Release Owner's decision, and it grants no permission.