Skip to content

Code quality guardrails: enforce every rule at the lowest layer (health → lint → CI → feature map → probabilistic tests → prose) #4296

Open
15 of 16 issues completed

Description

@DoodleBears

Human request (Vain, 2026-11-16). Companion to #4282, whose UI guardrails (#4294 static, #4295 runtime/visual) this spec reuses and does not duplicate.

Problem

The codebase is the context every agent reads. A small slip that merges (a floating promise, a 12k-line file growing by 300 lines, a rule that only lives in prose) is copied by the next agent and compounds. Today:

  • Lint is thin. .oxlintrc.json only has ignorePatterns: oxlint runs its default correctness set, with no typescript/react/import/unicorn/jsx-a11y plugins and no type-aware rules. Our own rules live in 14 scripts/check-*.mjs scripts that run only in pnpm lint, never in the editor.
  • Pre-commit only formats. .lintstagedrc.json runs oxfmt; nothing lints until CI. Agents (the main authors) get no feedback at edit time: .claude/settings.json has no hooks.
  • Structural health is unmeasured. 2,264 TS/TSX source files; the largest are client/locale.ts 12.0k lines, runtime/bot-runtime.ts 11.4k, bridge/methods.ts 10.6k, client/bridge.ts 7.4k. 47 mobile test files are excluded from tsc. No dead-code, cycle, duplication or boundary checks.
  • CI checks but does not review. verify.yml runs static/tests/perf-budget/e2e. Nobody reviews a PR against the linked issue or the repo's standards before a Human does.
  • The feature map cannot be targeted. verify-deepseekbot/features/ (pstack's feature map, 80 features) says how to drive and prove each feature, but no feature names its source paths or its glossary terms, so neither an agent nor CI can tell which features a diff or a bug report touches.
  • Tests are example-based only. No property-based, model-based or fuzz testing (fast-check is not a dependency). Perf has good guards (perf-budget job, render-commit benches, timeline/GenUI budgets) but no continuous trend.
  • AGENTS.md is 188 lines / ~40 KB, loaded into every agent, plus 7.3k lines in docs/agents/ and mobile docs, plus 343 ADRs (2.4 MB) whose current rules are spread across amendments. Many rules are checkable and some already are, but the prose does not say which.

Principle: push each rule to the lowest layer that can enforce it

Layer Where it bites Feedback time
L1 Codebase health The goal and its metric: a pnpm health report of ratcheted numbers that only improve —
L2 Lint Agent edit hook → editor (oxc extension) → pre-commit → pnpm lint seconds
L3 CI PR checks that need the diff/PR body, plus an AI review job minutes
L4 Trustworthy agent work Feature map ↔ source ↔ glossary: an agent locates the feature a diff or bug touches, proves it with the verification tooling, and reports in glossary terms minutes, before PR
L5 Probabilistic + perf testing Property/model-based/fuzz tests, UI monkey runs, perf benches, nightly health trend per PR + nightly
L6 Prose Only what no check can express (process, judgement, rationale), loaded on demand —

Every check follows the #4282 pattern: shrink-only baseline for existing code, an error message that names the source rule and prints the fix, and pnpm lint:fix applies mechanical fixes. A rule moved down a layer is deleted from prose, leaving at most a one-line pointer.

Guardrail registry. scripts/guardrails.json lists every rule: id, source doc anchor, layer, check, baseline file. pnpm lint verifies that every registered check exists, every baseline only shrank, and every doc line marked Enforced by points at a registered check, so docs and checks cannot drift apart. pnpm health reads the same registry.

L1 — Codebase health metrics (ratcheted)

Metric Tool Rule
Lint findings per file × rule oxlint JSON + scripts/lint-ratchet.mjs baseline only shrinks
File length ratchet script new files ≤ 800 lines; baselined files may not grow
Function size / cyclomatic complexity oxlint max-lines-per-function, complexity same ratchet
Import cycles, layer boundaries (Host ↔ Client, package public entries, mobile ↛ Host internals, ADR ownership boundaries) oxlint import/no-cycle + a boundaries config (dependency-cruiser if oxlint cannot express it) zero new
Dead exports, unused files and deps knip baseline only shrinks
Copy-paste duplication jscpd baseline only shrinks
Files excluded from tsc tsconfig.json exclude list list only shrinks
Always-loaded agent prose bytes of AGENTS.md, CLAUDE.md, apps/mobile/AGENTS.md only shrinks

L2 — Lint (edit time, before CI)

  1. Expand oxlint. Enable typescript, react, react-hooks, import, unicorn, jsx-a11y, promise plugins and the suspicious category; add type-aware rules through oxlint-tsgolint (stable since July 2026): no-floating-promises, no-misused-promises, switch-exhaustiveness-check, no-unnecessary-condition, await-thenable, restrict-template-expressions. Existing findings go into the ratchet baseline.
  2. One linter in the editor. Port the AST-shaped check-*.mjs rules (source policy: no comments / no useEffect / whole-store subscriptions; host casts; tool effects) and Design guardrails G1: turn the written UI/UX rules into lint with autofix #4294's rules into an oxlint JS plugin (scripts/oxlint-plugin-tobs/) so they show in the editor with a location and quick fix. Repo-shaped checks (ledger, ADR numbers, feature map, CI plan) stay scripts.
  3. Agent edit hook. .claude/settings.json PostToolUse on Edit/Write runs oxlint + oxfmt on the touched file and returns findings to the agent; the same for Codex hooks. PreToolUse refuses edits in the main checkout (worktree discipline).
  4. Pre-commit. lint-staged runs oxlint --type-aware on staged files and the fast scripts that accept paths; gitleaks protect --staged for secrets; refuse commits on main in the main worktree. Pre-push: pnpm typecheck + ci-affected --run for the pushed diff.
  5. Prose rules that become L2 rules: see the mapping table below.

L3 — CI evaluates and reviews

  1. Health delta summary. A health job posts one sticky PR comment: each L1 metric base → head, what improved, which baseline entry blocks. A worse metric already fails lint; the comment is for review.
  2. PR body lint. scripts/check-pr-body.mjs: Closes #N as plain text, the merge-risk bullet, the CI-plan line, visual-pr sections, issue-claim reference, glossary terms (L4). (UI evidence is Design guardrails G2: visual regression, accessibility and layout-contract checks in CI #4295 rule 6.)
  3. AI review. A review job runs Claude Code (GitHub Action) with the repo's code-review skill: Standards axis (repo rules + guardrail registry) and Spec axis (linked issue), posting inline findings. Advisory first; a finding class becomes blocking only after it proves precise, and a recurring finding should become an L2 rule instead (the review output is the backlog for new lint rules).
  4. Required checks. static, health, pr-body, tests and perf-budget become required on main.

L4 — Trustworthy agent work: feature map ↔ source ↔ glossary

Vain's framing: maintain the feature map and the verification tooling so that, on a bug or a change, an agent can locate the specific feature, prove the behaviour the way a user would, and describe pages and features in the terms GLOSSARY.md defines. pstack is already vendored (56 skills from cursor/plugins in .agents/skills/, locked in skills-lock.json); verify-deepseekbot/features/ is its feature map.

  1. Feature → source. Each features/*.md gets a Sources list (globs). check-feature-map.mjs fails when a glob matches nothing and reports source dirs no feature claims (the unmapped inventory ratchets down).
  2. Feature → glossary. Each feature names its Terms: the GLOSSARY.md entries for the pages, components and concepts it covers (GLOSSARY.md already has a parseable **Term / 中文**: + _Avoid_: shape, 302 entries). The check fails when a named term is not in the glossary.
  3. Glossary lint. scripts/check-glossary-terms.mjs flags _Avoid_ terms (e.g. 「弹窗」, "drawer", "Tob" for the product) in feature files, skill docs and, in CI, PR bodies and issue bodies the PR links, printing the preferred term. Off-glossary nouns in feature files fail; in PR text they warn. Baseline for existing docs.
  4. Diff / bug → feature. node scripts/feature-impact.mjs --base origin/main (or --paths, or --terms "<bug text>") prints the touched features, their journeys, glossary terms and whether they need a model. CI posts it; the PR's Verification bullet names a run (or a reason) for each touched feature. An agent triaging a bug starts from the same command.
  5. Upkeep. A scheduled maintain-verification-skill pass (pstack's upkeep loop) keeps map, sources and terms honest, one PR of proven corrections at a time; a glossary term added without a feature, or a feature whose terms left the glossary, shows up in its report.

L5 — Probabilistic, UI-fuzz and performance testing

Need Library / approach First targets
Property-based tests fast-check + @fast-check/vitest (test.prop, seed + path printed on failure, shrinking) pure logic: ci-plan rules, migration ledger, Markdown stream reveal, mention resolution, timeline cursors, call-grid tiling, usage totals (the ADR conversions below)
Model-based (stateful) tests fc.commands + fc.asyncModelRun against a simple model client store reducers, channels/sqlite-store, Outbox idempotency, ready-set harvest, approval lifecycle
UI fuzz (props/content) fast-check arbitraries (long CJK, emoji, RTL, empty, 10k-char, many rows) rendered in vitest browser mode / the #4295 gallery; invariants: no throw, no horizontal overflow, no clipped text, focus still reachable ds/ primitives, message rows, settings rows
UI fuzz (interaction) Playwright monkey run on a verify-app Host with fast-check-generated action sequences (click/type/scroll/resize/theme switch); invariants: no console error, no uncaught rejection, no long task > 200 ms, no layout jump; replayable by seed Bot mode main screens, nightly
Mobile fuzz Maestro flows with randomized input on Simulator (shared-device queue) later
Perf benches existing render-commit benches + vitest bench, tracked by CodSpeed (simulation mode, <1% variance on shared runners, blocks regressions on PRs), or a self-hosted baseline if a SaaS is not wanted store writes, timeline render, Markdown parse, bridge RPC encode
Render hotspots react-scan in dev builds + render-count assertions (extend client-store-*-render-bench) sidebar, timeline
Bundle / heap size budget on packages/client output; existing heap observation client bundle
Continuous monitoring nightly health workflow: full fuzz seeds, perf trend, L1 metrics → published trend page; a regression opens an issue —

All of this follows docs/agents/ax-performance.md (profile before fixing, A/B on frozen fixtures, budgets only tighten).

Prose → lowest layer (first pass over AGENTS.md)

Rule (source) Today Target Check
Scripts are .mjs, no .ps1/.cmd/.bat (Conventions) L2 check-no-shell-scripts keep, prose → pointer —
Spawn with shell:false + windowsHide:true (Conventions) prose L2 oxlint plugin rule on spawn/execFile/fork options
Never commit secrets (Conventions, ADR-0006) prose L2 + L3 gitleaks pre-commit + CI
Migration ids (Conventions) L2 check-schema-migrations keep —
Generated docs never edited; diagram SVGs committed; slides output not committed prose L3 CI regenerates (sync-docs, diagrams, slides:build) and fails on diff
OG font subset after Chinese copy change prose L3 test that every OG title glyph is in the subset
Vendored skills unedited (skills-lock.json) prose L2 hash check against the lock file
agent/skills/ mirrors .agents/skills/ prose L2 mirror check
Structured developer logs, no ad-hoc console (Developer diagnostics) prose L2 oxlint no-console in Host packages, baselined
/api interceptor owned by api-gateway (dsh-dev) prose L2 plugin rule: no connection.rpc.intercept('/api')
CLI parity L2 check-cli-parity keep —
Perf assessment for new features/dependencies; budgets only tighten prose + perf-budget L3 PR-body check requires the perf line when deps or hot paths change; budget files may only tighten without a perf:approved label
Worktree discipline prose L2 edit hook + pre-commit refuse the main checkout / main
Issue claim, Closes #N plain text, merge-risk bullet, CI-plan line, visual-pr prose + template L3 check-pr-body
Release ledger fragments L2 changelog:check keep —
CI plan rules L2 ci-plan --check keep —
Feature map updated when the app moves prose + structure check L4 Sources globs + impact report
Name the component by platform term; product nouns from the glossary prose L4 + L3 check-glossary-terms (_Avoid_ lists) + AI review
Store subscriptions select fields L2 check-source-policy keep (move into the oxlint plugin) —
DSH/Cordis vocabulary prose L3 AI review
UI design / copy / motion / tokens prose — owned by #4294 / #4295
Tracer-bullet delivery, IM browser QA, VPS, device QA, QA evidence, SEO, DSH upgrade, resource cleanup prose L6 stays prose, but moves out of always-loaded AGENTS.md into on-demand skills/docs behind a one-line router
343 ADRs prose L2/L3/L5 + L6 see the ADR cleanup comment: 23 delete, 46 convert, ~250 consolidated into 18 topic decision docs, 24 stale proposals resolved

docs/agents/*.md get the same pass, file by file, as each tracer bullet touches them.

Out of scope

UI rules already in #4294/#4295. Rewriting large files: the ratchet stops growth; splitting them is separate refactor work that the health report will prioritise.

Delivery: tracer bullets (sub-issues, in order)

  1. TB1 One rule through every layer (Guardrails TB1: one type-aware lint rule through agent hook, editor, pre-commit and CI with a shrink-only baseline #4297). Ratchet runner + guardrails.json + one type-aware rule (no-floating-promises) wired through the agent edit hook, editor config, lint-staged, pnpm lint and CI, with a baseline and a fix message. Proves the pipeline.
  2. TB2 Health report + structural ratchets. pnpm health: file length, complexity, cycles, tsc-exclude list, agent-prose bytes; CI sticky delta comment.
  3. TB3 Expand oxlint + first prose conversions. Plugins/categories; oxlint JS plugin with the spawn, no-console and /api intercept rules; gitleaks; worktree hooks; delete the converted prose from AGENTS.md.
  4. TB4 PR body lint + AI review job. check-pr-body; advisory Claude Code review using the code-review skill.
  5. TB5 Feature map ↔ source ↔ glossary. Sources and Terms for the 80 features, check-glossary-terms, feature-impact.mjs (diff, paths or bug text), CI impact comment.
  6. TB6 Property & model-based tests. fast-check foundation; first targets are the ADR invariants marked L5; seed reproduction in the failure message.
  7. TB7 UI fuzz + perf trend. Seeded Playwright monkey run on verify-app; nightly health workflow with perf benches tracked.
  8. TB8 Slim AGENTS.md. Move L6 runbooks into skills/docs behind a router; the prose-bytes ratchet locks it.
  9. TB9 ADR cleanup. One PR per topic: delete, convert (with its check), consolidate the rest into docs/decisions/<topic>.md with Enforced by links. Per-ADR dispositions are in the comment below, pending Vain's review.

Activity

  1. DoodleBears commented on Nov 16, 2026

    @DoodleBears
    ContributorAuthor

    ADR cleanup proposal (TB9, scope added by Vain 2026-11-16) — pending Vain's review, nothing deleted yet

    Vain's rule: an ADR stays as prose (L6) only when its decision cannot be pushed into L1–L5, and outdated ADRs are deleted. Git history keeps every deleted ADR, so deleting one is reversible.

    Inventory. There are 343 ADRs (2.4 MB): 213 Accepted, about 38 Proposed, and the rest with free-text statuses. Decisions are often patched in place ("Amended by", "Partly superseded by"), so the current rule for one area is spread across many files. Memory has 18 files, IM providers 45 and calls 21. An agent that reads one ADR can miss the amendment that overrides it, which is the slippage this spec targets.

    What can move down a layer. An ADR holds a what (an invariant) and a why (alternatives and trade-offs). The what usually fits an import/ownership boundary, a type, or a property, model-based or snapshot test. The why cannot be checked, but it is short once the amendment history is stripped.

    Proposal

    1. 🗑 Delete 23: fully superseded, retired, or PoC-era.
    2. 🔧 Convert 46: the invariant becomes a check whose error cites the topic section. The L5 entries are the first real targets for TB6 (fast-check).
    3. Consolidate the remaining ~250 into 18 topic decision docs (docs/decisions/<topic>.md). Each holds one current-state section per decision with a 2–5 line why and an Enforced by line, and no amendment history. The numbered files go away. check-adr-numbers becomes the registry check on Enforced by links. docs/architecture/ keeps owning how it works; topic docs own why.
    4. ❓ Resolve 24 stale Proposed ADRs (numbered below 0330). For each one, check the code: if it was built, merge it into its topic; if not, delete it and keep the idea in its issue.

    Method and limits. These dispositions come from each ADR's title, status, supersession notes and the opening of its decision. Each topic PR re-reads its ADRs in full before deleting anything, so a disposition can still change. sync-docs publishes ADRs at /dev/adr, so the site moves to the topic docs in the same PRs. Delivery is one small PR per topic, largest first (IM providers, Messaging, Sessions), and each PR lands its checks with it.

    Per-ADR dispositions

    Only deletions, conversions and stale proposals are listed per ADR. Every other ADR is listed by number under "Merge the why".

    Memory (18)

    • 0003 Memory is written only through explicit tools — 🗑 superseded by 0047
    • 0004 Inject the memory tree; retrieve bodies on demand — 🗑 superseded by 0047, 0060
    • 0013 Memory is one brain with per-entry visibility — 🗑 reversed by 0021
    • 0014 Persona is a human-owned memory file — 🗑 superseded by 0047, renamed by 0134
    • 0021 Memory has no visibility — 🔧 L2 type: Memory entries have no visibility/owner
    • 0060 The system prompt prefix is append-only — 🔧 L3 snapshot test: system prompt prefix only appends
    • 0134 Soul and Core Memory are Session-frozen system prompt files — 🔧 L3 snapshot test (with 0060)
    • Merge the why: 0002, 0012, 0047, 0068, 0084, 0088, 0092, 0097, 0140, 0154, 0190

    Bot identity & lifecycle (19)

    • 0032 Default avatars are deterministic blobatars — 🗑 status: superseded by ADR-0049
    • 0046 PersonaBot IDs are Host-owned; names and role badges are Human-facing — 🔧 L2 type: branded PersonaBotId
    • 0086 Custom PersonaBot avatars are bounded data URLs served by a read route — 🔧 L5 test: avatar data URL bound + fallback
    • 0118 Editable Avatar appearance is independent of activity presentation — 🗑 replaced by the 0148 pixel rig
    • Merge the why: 0015, 0016, 0057, 0130, 0135, 0148, 0156, 0177, 0212, 0223, 0225, 0247, 0248, 0268, 0274

    Sessions, Orchestrator & Assignments (27)

    • 0035 Session ownership is explicit, exclusive, and Registry-owned — 🔧 L2 boundary: only the Registry writes Session Ownership tables
    • 0193 Full access also unconfines the Orchestrator — 🔧 L5 (with 0205)
    • 0205 Bot Sessions follow DSH's permission mode for Shell and plugin tools — 🔧 L5 property test: permission matrix over modes
    • 0260 Delegated Subagents follow their root Session's full access — 🔧 L5 (with 0205)
    • 0261 Bot messages wake colleagues on every round; a runaway-only hop limit — 🔧 L5 property test: the hop limit bounds every chain
    • 0279 Interrupted Human DM turns continue in their Session — ❓ stale proposal
    • 0297 Machine Assignment dispatch separates creation, delivery and processing — 🗑 superseded by 0306
    • Merge the why: 0017, 0024, 0045, 0059, 0072, 0182, 0186, 0187, 0188, 0218, 0250, 0251, 0252, 0262, 0263, 0265, 0282, 0295, 0306, 0318

    Messaging & Channels (29)

    • 0030 Channel history is an append-only file log — 🗑 superseded by 0037
    • 0036 Messaging commands own every Messaging write — 🔧 L2 boundary: only Messaging commands write Messaging tables
    • 0037 Messaging facts share one BotHarness-owned SQLite transaction — 🔧 L2 boundary: one database owner opens SQLite
    • 0054 Channel live delivery follows durable commit — 🔧 L5 model-based test: live notify only after commit
    • 0061 Channel timeline pages use Host-owned opaque cursors — 🔧 L5 property test: cursor windows have no gaps or duplicates
    • 0099 A Human's all-Bot Group mention expands to ordinary direct mentions — 🔧 L3 test
    • 0125 Nearby context combines time coverage with count minima — 🔧 L5 property test
    • 0206 A Bot's typed @name resolves to one Group member; per-sender de-dup — 🔧 L5 property test
    • 0231 Busy Group review has an explicit progress boundary — ❓ stale proposal
    • 0232 Group recovery retains authorized commit receipts — ❓ stale proposal
    • 0293 Changes to placed messages are logged by database triggers — 🔧 L5 schema test
    • Merge the why: 0026, 0065, 0069, 0073, 0078, 0081, 0102, 0103, 0113, 0115, 0179, 0181, 0184, 0217, 0226, 0227, 0277, 0292

    Inbox & attention (13)

    • 0077 Turn-time harvest consumes the ready attention set — 🔧 L5 model-based test: one harvest turn per ready set
    • 0312 Notifications follow where the Human is attending — ❓ stale proposal
    • Merge the why: 0025, 0070, 0071, 0074, 0075, 0076, 0098, 0109, 0110, 0119, 0133

    Persistence, backup & usage (19)

    • 0005 SQLite is an optional index — 🗑 superseded by 0037/0041
    • 0019 The Soul registry is a hosted service — 🗑 SoulSnapshot registry retired (0134, 0267)
    • 0020 SoulSnapshot is an immutable, content-addressed package — 🗑 retired (0134)
    • 0040 PersonaBot Export wraps Soul and selected operational facets — 🗑 retired by 0134
    • 0041 One database owns all BotHarness operational state — 🔧 L2 boundary (same rule as 0037)
    • 0063 Operational logs live in a separate database file — 🔧 L2 boundary: only the logging module opens logs.db
    • 0204 An exact total settles omitted usage buckets — 🔧 L5 property test
    • 0257 Profile Backup compatibility is owned by the data contract — 🔧 L3 contract test over backup fixtures of each version
    • 0258 Foreign key orphans do not block the operational database — 🔧 L3 test
    • 0341 Named schema migrations have an append-only ledger — 🔧 L2 check-schema-migrations (exists)
    • Merge the why: 0027, 0034, 0042, 0043, 0044, 0093, 0094, 0146, 0344

    External IM providers (45)

    • 0001 Adopt dsh-im as the base plugin — 🗑 replaced by 0011
    • 0006 Feishu app secrets live in the DSH credentials service — 🔧 L2 gitleaks + L3 secret scan; test that IM config holds only credential refs
    • 0009 Reply scope defaults to thread-first — 🗑 now dsh-im config (0011)
    • 0010 Keep self-built capabilities in-repo for now — 🗑 PoC-era
    • 0039 The external outbox is durable and idempotent — 🔧 L5 model-based test: dispatch under retry/crash is idempotent (formal-verification candidate)
    • 0127 Product artifacts compose an independently versioned IM Provider — ❓ stale proposal
    • 0128 Discord checked replies preserve native child-channel routing — ❓ stale proposal
    • 0143 An external conversation streams into a Channel as one-way context — ❓ stale proposal
    • Merge the why: 0008, 0011, 0038, 0101, 0104, 0105, 0106, 0107, 0108, 0111, 0112, 0117, 0120, 0122, 0126, 0129, 0136, 0137, 0139, 0141, 0142, 0145, 0149, 0151, 0152, 0165, 0168, 0171, 0173, 0174, 0175, 0176, 0197, 0253, 0275, 0276, 0343

    Computer (13)

    • 0050 Computer use is an optional standalone package — 🗑 replaced by 0079 (fold the packaging point into the topic)
    • Merge the why: 0051, 0052, 0055, 0058, 0062, 0079, 0080, 0082, 0083, 0163, 0210, 0245

    Browser (10)

    • 0091 Bot Tabs are window-scoped work surfaces — 🗑 superseded by 0095
    • Merge the why: 0089, 0090, 0095, 0096, 0114, 0116, 0121, 0123, 0124

    Workspaces & files (7)

    • Merge the why: 0018, 0048, 0067, 0100, 0178, 0238, 0345

    Approvals, secrets & private input (20)

    • 0166 / 0167 / 0169 / 0172 private input proposals — ❓ stale proposals
    • 0170 Private MCP consumption uses a fixed server — 🗑 status Superseded
    • 0224 Tob management uses a scoped native Shell CLI journey — 🗑 superseded by 0314
    • 0239 Three-action tool approval and Full Access use native ask — 🔧 L5 (with 0205)
    • 0249 Every approval card can save explicit tool authorization — 🔧 L5 property test: saved authorization is deterministic
    • 0342 Bot approval selects one template; deterministic authorization separate — 🔧 L5 (with 0249)
    • Merge the why: 0164, 0189, 0191, 0192, 0195, 0196, 0198, 0207, 0208, 0314, 0346

    Desktop / Web UI (29)

    Mobile app (29)

    • 0201 The mobile design system maps Web roles onto native components — 🔧 L2 style-guard (exists) + Design guardrails G1: turn the written UI/UX rules into lint with autofix #4294 rule 12
    • 0264 Mobile motion uses each platform's springs — 🔧 L2 rule: motion only through motion.ts springs
    • 0266 Mobile design tokens: shared layer + per-platform layer — 🔧 L2 token tests (exist)
    • 0294 The phone's local message store is SQLite without an ORM — 🔧 L2 dependency ban
    • 0319 Android message targets acknowledge native bounds — 🗑 superseded by 0320
    • 0214 / 0271 / 0273 / 0278 / 0325 — ❓ stale proposals
    • Merge the why: 0199, 0200, 0202, 0211, 0213, 0219, 0228, 0229, 0230, 0235, 0255, 0272, 0298, 0320, 0321, 0322, 0323, 0324, 0335

    Calls & voice (21)

    • 0209 Selkies WebRTC per phone call — ❓ stale proposal
    • 0284 Android Bot calls are foreground only — 🗑 superseded by 0305
    • 0303 Call grids tile balanced rows of at most three — 🔧 L5 property test
    • Merge the why: 0280, 0281, 0283, 0285, 0286, 0287, 0288, 0289, 0290, 0291, 0299, 0304, 0305, 0307, 0308, 0310, 0315, 0317

    Connect, remote Hosts & Team mode (18)

    • 0296 / 0309 / 0313 / 0316 / 0326 — ❓ stale proposals
    • Merge the why: 0241, 0242, 0243, 0244, 0246, 0327, 0333, 0334, 0336, 0337, 0338, 0339, 0340

    Release, CLI, telemetry & diagnostics (20)

    • 0066 Client Bundle package identity — 🔧 L2 manifest check
    • 0087 DSH compatibility SemVer range — 🔧 L2 check: every package's engines.dsh matches the verified floor
    • 0132 Anonymous PostHog telemetry and campaign short links — ❓ stale proposal
    • 0159 / 0162 CLI verbs never touch the database; explicit Host authority — 🔧 L2 boundary: CLI packages never import the database
    • 0216 Product versions identify immutable package sets — 🔧 L3 release check
    • 0254 Message Feedback separates private evidence — 🗑 superseded by 0256
    • 0270 Telemetry events follow one tracking plan — 🔧 L3 telemetry-plan test (exists)
    • Merge the why: 0033, 0049, 0064, 0157, 0158, 0160, 0161, 0256, 0311, 0330, 0331, 0332

    Marketplace (3) — Merge the why: 0131, 0240, 0267

    GenUI (3)

    • 0301 GenUI rich documents use isolated HTML — 🔧 L2 rule: GenUI HTML renders only in the isolated frame
    • Merge the why: 0300, 0302

    Generated by Claude Code

  2. DoodleBears commented on Nov 16, 2026

    @DoodleBears
    ContributorAuthor

    What else to adopt from pstack (poteto)

    pstack is already vendored: 56 skills from cursor/plugins in .agents/skills/, its guide in .agents/docs/guide/, and the poteto-agent and comment-sicko agents. The 1–5 + 6 ladder in this spec is poteto's /correct ladder (skills/correct/SKILL.md, guide 09 "Fix the environment with /correct"): architecture → types → a lint/CI check whose error names the fix → a test → docs last. pstack also has a principle-encode-lessons-in-structure skill: "If the fix is structural, only use the structural fix. The instruction is the symptom." This spec already uses several of these ideas; the rest are adopted below.

    Conventions from /correct folded into the spec

    1. L1 is "make it impossible", not only "measure it". The first move is architecture: one owner per piece of state, one supported way per task, internals hidden so a wrong import fails, hand-synced lists replaced by one source of truth, and old ways deleted so agents cannot copy them. The ADR boundary conversions (0023, 0035–0037, 0041, 0063, 0159) are this layer. The health metrics measure it.
    2. Types come before lint. "Enforce it with types so the bad state can't be written." In practice: branded IDs (ADR-0046), discriminated unions with exhaustive switches (switch-exhaustiveness-check), and unknown at boundaries (typescript-best-practices). Design guardrails G1: turn the written UI/UX rules into lint with autofix #4294 rules 4 and 11 already work this way.
    3. "If the pattern is already common, fail only when a change adds more." This is the shrink-only baseline.
    4. Every new check proves it fails on a real past mistake. Each guardrails.json entry gets a fixture taken from a real commit, revert or review comment where the mistake happened. The check must fail on that fixture in a test. "A check you've never seen fail proves nothing."
    5. Exceptions sit on the offending line with a reason, an expiry date and a Human's approval. The ratchet treats an expired or unapproved suppression as a finding.
    6. The rule table lives in the agent instruction file. Generate a compact "Rule → Enforced by" table into AGENTS.md from guardrails.json. When an agent is corrected for a rule that is already in the table but has no enforcement, that is a repeat and gets fixed structurally in the same change. A rule is dropped once its mistake can no longer happen.
    7. The same command runs locally and in CI. Every check is a pnpm script, and CI only calls the scripts.

    Skills and workflows to wire in

    pstack piece Where it goes
    /correct with no argument Seeds the backlog. Mine recent commits, reverts and review comments for mistake classes that happened at least twice. Run it once before TB3 and then on a schedule. The AI review job (L3) feeds it too.
    /create-formal-verification-skill + maintain-… L5, beyond fast-check. For ordering and concurrency invariants that tests rarely reach: TLA+ models of Outbox retry/idempotency (ADR-0039), ready-set harvest (0077), live-after-commit (0054), and Connect enrollment issue/cancel (0339). Each check is shown failing on a broken variant, and the skill records which code it covers and the commit it last matched.
    /statechart Renders those models as user-facing statecharts in glossary terms, generated from the TLA+ so the picture cannot drift. Useful in topic decision docs (TB9).
    /maintain-verification-skill L4 upkeep. The guide says to run it at least daily from an automation; it becomes a nightly routine.
    /blast-radius L4 self-review before the PR: what the change breaks outside the diff, proved by running code. Pairs with feature-impact.mjs.
    /interrogate L3 review job for risky PRs: multi-model adversarial review (the ci:full / high merge-risk class). code-review stays the default.
    principle-explain-the-number + /benchmark-checklist L5 perf evidence: every perf claim in a PR names what limits the number. The perf-trend job's report uses the checklist.
    /no-comments / comment-sicko Already enforced in L2 (check-source-policy); nothing to add.
    /reflect / /retro Session lessons go to skills; repeated mistakes go to /correct. This is the intake for new guardrails.
    Opening-a-PR playbook Small ordered commits, a clean diff and unslopped prose. Its checks merge into check-pr-body (TB4).
    Automation pack (guide 07) Later: triage → reproduce (through the feature map) → fix → verify, run on schedule. It depends on L4 working first ("don't loop before you trust the loop").

    Tracer-bullet changes

    • TB1 adds a past-mistake fixture and the line-level exception format (reason + expiry + approver).
    • New TB0: run /correct (read-only) over recent history and attach its mistake classes to this issue. That ranks the L2/L3 backlog by real frequency instead of guesses.
    • TB6 adds one formal-verification skill (Outbox idempotency, ADR-0039) next to fast-check.
    • TB8 generates the AGENTS.md rule table from guardrails.json.

    Generated by Claude Code

  3. DoodleBears commented on Nov 16, 2026

    @DoodleBears
    ContributorAuthor

    Delivery update (Vain, 2026-11-16)

    • TB1 is in review in feat(lint): type-aware floating-promise rule through a shrink-only lint ratchet (guardrails TB1) #4299.
    • TB9 ADR cleanup is approved as a pilot first: the Memory topic (18 ADRs) goes into one topic decision doc, with 0021, 0060 and 0134 converted to checks. Vain decides from that PR whether to roll the approach out to the other 17 topics.
    • New TB10: TLA+ models + statecharts (pstack /create-formal-verification-skill, /statechart), adopted at Vain's request. It is split out of TB6. Targets in order: Outbox retry idempotency (ADR-0039), ready-set harvest (0077), live notify only after commit (0054), Connect enrollment issue/cancel (0339). Each model must fail on a deliberately broken variant before it counts. The statechart for each one is generated from the TLA+ and embedded in its topic decision doc, so the picture and the checked model cannot drift.
    • New TB0: a read-only /correct pass over recent history to rank the L2/L3 backlog by how often each mistake actually happened.

    Generated by Claude Code

  4. DoodleBears commented on Nov 16, 2026

    @DoodleBears
    ContributorAuthor

    Merge policy (from the maintainer, 2026-11-16, revised)

    The guardrail layers are what make merging trustworthy. When CI and the repo rules pass, an internal PR merges. This includes UI/UX changes: fix forward with a follow-up PR instead of holding the merge.

    • Merge when green (internal PRs): any PR opened by a maintainer or a maintainer's agent that passes all required CI and the repo rules (ratchet, source policy, CLI parity, feature map, PR template). The agent merges it itself, as a squash pinned to the head SHA it checked. UI/UX feel issues found after merge get a new PR.
    • Delete the head branch after merge. The repo setting "Automatically delete head branches" does this for every merge, and an agent that merges also deletes the branch where it can.
    • Always held for a human:
      • External contributions: PRs from contributors outside the org or from forks. No agent merges or enables auto-merge on them, whatever CI says.
      • Serious one-way doors and changes that risk a production incident or a bad live experience, for example:
        • irreversible data or schema migrations
        • deleting or rewriting user data
        • auth, secrets or permission changes
        • release, store or deploy pipeline changes
        • public API or protocol breaks that installed clients depend on
    • Repo auto-merge stays off. Agents merge explicitly after they confirm green CI on the head SHA. No standing repo setting can merge a PR on its own.
    • TB11: turn this into a check rather than prose.
      • Add a CI job that labels a PR needs-human when its author is external or its diff touches one-way-door paths, such as schema migrations, release workflows, auth and secrets, or protocol contracts. Reuse the ci-plan area rules so the path list lives in one place.
      • Agents never merge a PR that carries that label.

    Generated by Claude Code

  5. DoodleBears commented on Nov 16, 2026

    @DoodleBears
    ContributorAuthor

    Provenance labels: harness and model (from the maintainer, 2026-11-16)

    Every issue and PR an agent implements carries the harness and model that wrote it. These labels are provenance for the multi-model evaluation and for review triage.

    • harness:<name>: the agent runner, lowercase. For example harness:claude-code, harness:codex, harness:cursor, harness:opencode.
    • model:<id>: the model id without effort or date suffixes, lowercase. For example model:claude-opus-5-5, model:deepseek-v4-pro, model:kimi-k3.1-pro. Use the served model the runner reports, not the configured alias.
    • Several are allowed and they add up. Every harness and model that wrote code for the issue or PR gets its label. Unlike agent:active, these labels are never removed when the work ends.
    • Apply them when the PR is opened, in the same call. On this repo, a label change on a PR re-triggers verify and cancels the run in progress.
    • Missing labels are created by the first agent that needs them. A maintainer sets the color later. Suggested colors: harness labels blue, model labels purple.

    Applied so far: #4296, #4297, #4299 and #4300 carry harness:claude-code and model:claude-opus-5-5.

    TB12 (planned):

    • Move this rule into agent-work-trace.md.
    • Add a check that fails a PR whose body carries an agent trailer (Agent-Task: or Co-Authored-By: from an agent) but has no harness: or model: label.

    Generated by Claude Code

  6. 124 remaining items

  7. DoodleBears commented on Nov 19, 2026

    @DoodleBears
    ContributorAuthor

    Agent work claim

    • Agent: Codex
    • Task: codex/local/01a1f288-d03a-7481-b2c1-e044f7934e09 (a Codex task)
    • Issue scope: TB9 Mobile app UI, the 14 navigation, design and native timeline ADRs
    • Branch: codex/4296-tb9-mobile-ui
    • Started: 2026-11-19 06:41 UTC
    • State: active
  8. DoodleBears commented on Nov 19, 2026

    @DoodleBears
    ContributorAuthor

    Agent work outcome

  9. DoodleBears commented on Nov 19, 2026

    @DoodleBears
    ContributorAuthor

    Agent work outcome

  10. DoodleBears commented on Nov 19, 2026

    @DoodleBears
    ContributorAuthor

    Agent work claim

    • Agent: Codex
    • Task: codex/local/01a1f310-4527-7a23-9535-1f3e6fd6265d (Codex task)
    • Issue scope: TB9 tail (0255, 0316, 0346, 0349 and future decision authoring) and TB8 always-loaded runbook router and prose ratchet
    • Branches: codex/4296-tb9-tail, codex/4296-tb8-slim-agents
    • State: active
  11. DoodleBears commented on Nov 19, 2026

    @DoodleBears
    ContributorAuthor

    Agent work outcome

  12. added this to the v1.8.0 milestone on Nov 19, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions