The declaration counter does not see `export { x } from "./y.js"` or
`export *`, so a re-export would re-publish helpers from this file's
namespace without touching either ceiling. Assert against that syntax.
The shared tokenizer accepts `ms` for the simulation windows, and without a
per-caller unit set that grammar leaked into --expire: `--expire 500ms` was
a usage error before the parsers were unified and became silently rounded to
a 1h / 1s link after.
tokenizeDuration now takes an allowed-unit set; the expire flags pass
EXPIRE_UNITS (d/h/m/s) while parseDurationMs keeps the full set. Adds a
regression test asserting sub-second input stays exit 2 on both flags.
Two findings from reviewing the outbound-push extraction:
The verify poll compared `record.sourceDocumentSN === sn` with `sn` optional,
so a caller that only knows the flowId compared against `undefined` and
matched any record lacking an SN — reporting an unrelated run as the one this
push created, with its id and taskMode in the response. Guard the needle:
an absent SN matches nothing. This class did not exist on the deploy path
before (it compared against flowId only), so it was introduced by the merge.
The replay help text also never listed --sign-key even though the channel
resolves the target integration through it, and selectHoseIntegration now
errors on an ambiguous list with "请通过 --sign-key 指定" — pointing at a
flag the user could not discover from `help approval-runs`.
Adds direct tests for replay-safety.ts (the exit-14 wording, the next action,
and that --force is the only override), which previously had none.
The file is the registry's catch-all (~85 exports over unrelated domains),
and index.ts re-exports all of it into every capability's namespace — which
is why helpers get re-derived rather than reused, and why unrelated work
keeps landing here.
A comment alone would not stop the next addition, so the ceiling is enforced
by test: helpers.freeze.test.ts fails when the file grows past its line or
export count, and the failure message names where the logic should go
instead. Both ceilings only ever drop — moving an export out to a focused
module is the intended change, followed by lowering the constant. Verified
by temporarily adding an export: both assertions fire.
Records the policy in .agents/rules/typescript-style.md as well, since the
ratchet explains what to do and the rule explains why.
service.ts interleaved orchestration (cache-first trace access) with ~200
lines of flow heuristics — stage word tables, evidence collection, source
classification — and carried near-isomorphic copies of the collector for the
attachment and rule flows. None of it had tests.
flows.ts now owns the heuristics: one collectEvidence shared by both flows,
stage vocabulary as data tables so tuning a word list cannot alter a code
path, and an explicit attachment/rule difference (only the rule flow falls
back to scanning every observation when a stage has no named candidates).
summary.ts holds the trace/observation projections both the service and the
flows need, which also keeps service <-> flows acyclic.
Adds 15 tests over the previously untested branches, including the two
behaviors the extraction surfaced: the "unknown" classification arm is
unreachable as written, and a filename-only needle set can never reach the
OCR/inference grading.
The two --expire flags each carried a byte-identical copy of the same regex
and unit-conversion switch, and a third parser (parseDurationMs) lived in
capabilities/helpers.ts with yet another regex. Because the copies were
independent, --expire 300 could be read differently on each path without
anyone noticing.
core/duration.ts now owns the grammar (tokenizeDuration) and the unitless
heuristic (expireSeconds: a bare number <= 168 reads as hours, larger as
seconds). Each flag keeps only what genuinely differs: Seal delegation links
floor to whole hours and cap at 168h, Hose links round to seconds, simulation
windows are milliseconds and fall back instead of failing the batch.
Adds a cross-flag regression test asserting both --expire parsers read the
same literal the same way.
The deploy capability and the cross-tenant replay each carried their own
copy of the same outbound pipeline: integration selection, the assisted-only
gate, payload/URL construction, and push-then-verify. A change to the wire
contract could drift into one path and not the other.
Move the shared parts into domains/seal/outbound-push.ts and return the raw
CloseAPI messageLog query to the hose domain (domains/hose/close/outbound.ts),
leaving only the replay-specific log matching on the seal side. The
production-target guard is now one implementation (replay-safety.ts) shared
by the corp-pair resolver and the channel validator; both call sites are
kept deliberately as defense in depth.
Behavior note: replay used to silently pick the first integration when the
target had several and no --sign-key was given. It now errors and lists the
available signKeys, matching what deploy already did — pushing a message to
the wrong outbound channel should not depend on array order.
The report previously could not compute human accuracy because upstream only
says whether AI and human agree, never who was right. This adds an append-only
local store so a reviewer judges each (typically diverged) document across
weekly passes, and report monthly folds those judgments back in.
- review-store.ts: JSONL per tenant+month (~/.config/seal-use/reviews/
<corpId>-<YYYY-MM>.jsonl), append-only (weekly passes never rewrite), one
record per SN; last write wins on re-adjudication. Verdicts: ai_correct,
human_correct, both_correct, both_wrong, undecided. Env-overridable root
(SEAL_USE_REVIEWS_DIR) for tests; corrupt lines skipped.
- collect.ts: load the store, join verdicts onto fetched blocks, compute
humanAccuracy = (human_right / reviewed) * 100 over adjudicated samples,
expose reviewedCount/divergedCount, and flip humanAccuracyAvailable. No
reviews -> honest gap (still unavailable), never fabricated.
- render.ts: when available, fill the §1.2 human row with real accuracy and
replace the gap warning with a coverage note; when not, keep the warning.
- CLI: `report review set/list --month ... [--sn --verdict --note
--reviewed-by]` (set writes local store, list reads it). Help registers
both as separate commands; read-only list vs mutating set classified
accordingly. Prefix help (`report review --help`) now lists subcommands
instead of erroring.
- parser: register --template/--report-id/--max-runs/--verdict/--reviewed-by
(the first three were previously rejected as unknown, breaking report
monthly's own flags); reviewed-by moves to VALUE_FLAGS so it consumes its
argument.
- SKILL.md: document the adjudication workflow and storage semantics.
Verified: 639 tests (6 new review tests incl. tenant/month isolation, corrupt
line skip, join + accuracy math, honest no-review gap, render coverage note),
tsc clean, oxlint 0 warnings.
Eats in the ai-audit-report-template as a module. The template is the mutable
skin: describeTemplate() infers per-section data demands from ##/### headings
(keyword rules), so editing/renaming/reordering sections does not require
touching collect or render code.
- src/domains/seal/reports/: describe (heading to demand), collect (performance/
risk blocks/template groups, fetched only for declared demands), render (fills
tables by section+column signature, rewrites narrative by structure not line
number), monthly (orchestrator returning content + per-section completeness +
notes).
- report-templates/: the template body, assets, example, and downstream
validate.py/render.py (not bundled; next.validate/render in the result point
at them).
- Capability sealReportMonthlyGet (read-only, allow-listed) + CLI
"seal-use report monthly --month <YYYY-MM>" + help + KNOWN_FLAGS month +
read-only report:monthly.
- SKILL.md: routing row + a section stating the two hard rules: the template is
swappable, and metrics with no upstream source keep template sample values
with a warning note instead of fabricated numbers.
Template-path resolution branches on isCompiledBinary() (dev: module-relative to
repo root; compiled: cwd), matching how rules lint --file resolves paths, since
templates are not embedded.
Verified: bun test 633 pass (6 new reports tests), tsc clean, oxlint 0 warnings.
Live smoke: 2026-08 report for a real corp fills real accuracy/counts/distribution
and marks human-accuracy + mismatch-classification + section-6 sample rows with
gap notes.
- checker implementations move to linter/checkers/, eliminating the builtin/strict/hlab + index + types files sitting flat in linter/
- manifest.ts is the single source of truth for which official linters exist and which are plaintext-exposed (plaintext flag)
- plaintext.generated.ts replaces the hand-maintained official-templates.ts (580 lines): generated from checkers/ by scripts/generate-linter-plaintext.mjs, refreshed by bump-version, guarded in CI by verify:linter-plaintext
- loader is manifest-driven (list, resolve, aliases); cwd linter loading is removed - custom linters resolve only from ~/.config/seal-use/linters/