Skip to content

docs(desktop): unblock agents-md-lean by moving agent-swift reference into docs/ - #11410

Merged
undivisible merged 2 commits into
BasedHardware:mainfrom
undivisible:fix/agents-md-lean-budget
Aug 11, 2026
Merged

undivisible merged 2 commits into
BasedHardware:mainfrom
undivisible:fix/agents-md-lean-budget

Conversation

@undivisible

@undivisible undivisible commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

Why

The agents-md-lean manifest check is red on main: desktop/macos/AGENTS.md was 47392 bytes against its 47000-byte budget, pushed over by e2a792eb0a (a 2-line Release Pipeline docs correction on Aug 10).

The check selects on **/AGENTS.md and the pre-push gate diffs against merge-base, so every PR that touches any AGENTS.md fails, and the failure aborts the Hygiene job before the other guards run. Tracking: #11409.

What changed

The fix is content, not the budget — the budget is untouched.

  1. Moved the Verifying UI Changes (agent-swift) section verbatim into desktop/macos/docs/agent-swift-ui-verification.md, leaving a one-line pointer. It is occasional tool reference, not per-session guidance — exactly what the check's own failure hint recommends (component AGENTS.md -> docs/<topic>.md).
  2. Deleted one duplicated sentence in Release Pipeline (Promotion from beta to stable is handled by desktop_promote_prod.yml, not Codemagic), which restates the "Stable is manual" bullet directly above it. No release-contract prose was rewritten or paraphrased.

No information lost.

Result

desktop/macos/AGENTS.md: 45531 bytes / 47000 (1469 bytes headroom), 532 / 560 lines — enough that the next small docs edit will not re-break main.

Headroom for the other guides:

File Bytes Headroom
backend/AGENTS.md 38936 / 39000 64
AGENTS.md 16872 / 18000 1128
app/AGENTS.md 10606 / 11500 894
web/admin/AGENTS.md 1363 / 1500 137
.github/AGENTS.md 3825 / 4500 675
omi/firmware/AGENTS.md 853 / 1500 647

backend/AGENTS.md is 64 bytes from the same failure and will recur; that needs its own PR.

Verification

  • python3 .github/scripts/check_agents_md_lean.py → ok: 7 AGENTS.md files within budget (fails on clean origin/main)
  • make preflight → passes with the no-changelog-needed label (docs-only, no user-visible change)

Product invariants affected: none (scripts/pr-preflight --suggest). No fix: commits, so no failure-class declaration is required.

🤖 Generated with Claude Code

Review in cubic


Note

Low Risk
Documentation-only relocation and a one-line dedupe; no runtime, release, or product behavior changes.

Overview
Brings desktop/macos/AGENTS.md back under the agents-md-lean byte budget so the Hygiene check and PRs that touch AGENTS.md can pass again.

The long Verifying UI Changes (agent-swift) block is moved verbatim to docs/agent-swift-ui-verification.md, with AGENTS.md keeping a short pointer plus the prod-bundle warning. One duplicate Release Pipeline sentence about beta→stable promotion (already covered by the Stable-is-manual bullets) is removed. No release-contract or agent-swift guidance was rewritten—only relocated or deduped.

Reviewed by Cursor Bugbot for commit 0a523bb. Configure here.

The agent-swift command reference is occasional tool reference, not
per-session guidance; docs/agents-style reference is the pressure valve
for a component guide. Moved verbatim to
desktop/macos/docs/agent-swift-ui-verification.md with a pointer left in
place.
"Promotion from beta to stable is handled by desktop_promote_prod.yml,
not Codemagic" restates the Stable-is-manual bullet above it verbatim in
substance.
@undivisible undivisible added the no-changelog-needed Skip desktop changelog enforcement for internal-only changes label Aug 11, 2026
@cursor

cursor Bot commented Aug 11, 2026

Copy link
Copy Markdown

Bugbot couldn't run - usage limit reached

Bugbot is counted against Cursor usage for this user or team, and this run hit a usage or spend limit.

A user or team admin can review and increase usage limits in the Cursor dashboard.

(requestId: serverGenReqId_7f086421-8393-454c-97fe-add56912888b)

@cubic-dev-ai cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 2 files

Confidence score: 5/5

  • Automated review surfaced no issues in the provided summaries.
  • No files require special attention.

Re-trigger cubic

@Git-on-my-level Git-on-my-level left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified this in a worktree — clean fix for the red agents-md-lean gate.

desktop/macos/AGENTS.md — The full agent-swift UI verification section (setup, 15-command reference, key rules) is replaced by a one-line pointer to the new docs/ file. I confirmed the move is verbatim: the extracted old section matches the new file byte-for-byte (only the header changed from ### to #). The pointer correctly names the tool, summarizes what the linked doc contains, and preserves the critical safety rule ("Never automate prod bundles"). The deleted "Promotion from beta to stable…" sentence is genuinely redundant — the bullet directly above already states desktop_promote_prod.yml remains workflow_dispatch only.

desktop/macos/docs/agent-swift-ui-verification.md — New 28-line doc, content is the verbatim move. Follows the same docs/ pointer pattern already used by three other links in the same AGENTS.md.

Agent-guidance note: this relocates agent instruction content from the inline AGENTS.md into a linked doc. The content is unchanged and the prod-automation safety constraint is preserved in both the pointer and the moved file, so the behavioral impact is low — agents following the pointer get identical guidance.

check_agents_md_lean.py passes (45531/47000 bytes, was 47392 on main). Checks green. Approving.


by AI on behalf of David — if you need David’s attention urgently, please @Git-on-my-level and escalate with need human response.

@undivisible
undivisible merged commit efa332f into BasedHardware:main Aug 11, 2026
44 of 47 checks passed
undivisible added a commit to undivisible/omi that referenced this pull request Aug 12, 2026
It was 1363/1500 bytes, 137 from the failure that took main red today
(BasedHardware#11409/BasedHardware#11410) and blocks every PR touching any AGENTS.md. The networking
and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md
with the two top-level rules and a pointer left behind. No information lost.

Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched.
Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
undivisible added a commit that referenced this pull request Aug 12, 2026
…11411)

Preventive: `backend/AGENTS.md` had **64 bytes** of headroom under its
39,000-byte `agents-md-lean` budget. When a component guide blows its
budget the check goes red on `main`, and since it triggers on
`**/AGENTS.md`, **every** PR touching any AGENTS.md then fails and
aborts Hygiene before the other guards run. That just happened with
`desktop/macos/AGENTS.md` (#11409, fix in #11410). Backend was one
sentence away from a repeat.

## What moved (nothing deleted, nothing paraphrased)

| From `backend/AGENTS.md` | To |
|---|---|
| Per-subservice internal bullets in the Directory Structure tree
(pusher, diarizer, agent-proxy, nllb_translation, modal) |
`backend/docs/subservice-internals.md` |
| Five-row memory continuity gauntlet gate coverage table |
`backend/docs/memory-continuity-gates.md` |

Both moved verbatim, each leaving a pointer. Setup, test commands, the
Service Map and its deploy contracts, async/executor rules, and
logging-security rules all stay in `AGENTS.md` — that is what agents
read constantly.

## Result

`backend/AGENTS.md`: 38,936 → **35,829 bytes** (headroom **3,171**), 337
→ 309 lines (headroom 41). No budget in `check_agents_md_lean.py` was
touched.

## Verification

- `python3 .github/scripts/check_agents_md_lean.py` — backend passes;
the only remaining failure is the pre-existing `desktop/macos/AGENTS.md`
overage that #11410 fixes.
- `make preflight` — with #11410 merged locally into a throwaway branch,
`agents-md-lean` and every other selected check passes on this diff.

## Also worth flagging (not fixed here)

`web/admin/AGENTS.md` is at **137 bytes** of headroom (1,363 / 1,500)
and 4 lines spare — next candidate for the same treatment.

Product invariants affected: none (`scripts/pr-preflight --suggest`). No
`fix:` commits, so no failure-class declaration is required.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/11411?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Documentation-only relocation with no code, config, or runtime
changes. Content is moved verbatim with pointers left in place.
> 
> **Overview**
> Shrinks `backend/AGENTS.md` under the `agents-md-lean` size ratchet by
moving two verbatim detail blocks into dedicated docs, leaving pointers
behind.
> 
> **Subservice internals** (pusher, diarizer, agent-proxy,
nllb_translation, modal bullets) move to
`backend/docs/subservice-internals.md`. The Service Map and deploy
contracts stay in `AGENTS.md`.
> 
> **Memory continuity gate coverage table** moves to
`backend/docs/memory-continuity-gates.md`. No product or runtime
behavior changes.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
b7906af. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
undivisible added a commit that referenced this pull request Aug 14, 2026
It was 1363/1500 bytes, 137 from the failure that took main red today
(#11409/#11410) and blocks every PR touching any AGENTS.md. The networking
and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md
with the two top-level rules and a pointer left behind. No information lost.

Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched.
Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
undivisible added a commit that referenced this pull request Aug 16, 2026
It was 1363/1500 bytes, 137 from the failure that took main red today
(#11409/#11410) and blocks every PR touching any AGENTS.md. The networking
and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md
with the two top-level rules and a pointer left behind. No information lost.

Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched.
Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
undivisible added a commit that referenced this pull request Aug 17, 2026
It was 1363/1500 bytes, 137 from the failure that took main red today
(#11409/#11410) and blocks every PR touching any AGENTS.md. The networking
and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md
with the two top-level rules and a pointer left behind. No information lost.

Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched.
Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
undivisible added a commit to undivisible/omi that referenced this pull request Aug 25, 2026
It was 1363/1500 bytes, 137 from the failure that took main red today
(BasedHardware#11409/BasedHardware#11410) and blocks every PR touching any AGENTS.md. The networking
and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md
with the two top-level rules and a pointer left behind. No information lost.

Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched.
Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
undivisible added a commit that referenced this pull request Aug 26, 2026
It was 1363/1500 bytes, 137 from the failure that took main red today
(#11409/#11410) and blocks every PR touching any AGENTS.md. The networking
and revenue-metrics detail moves verbatim into web/admin/docs/data-contracts.md
with the two top-level rules and a pointer left behind. No information lost.

Result: 457/1500 bytes (1043 headroom), 6/25 lines. Budget untouched.
Verification: python3 .github/scripts/check_agents_md_lean.py -> ok: 7 files
undivisible added a commit that referenced this pull request Aug 26, 2026
…est lane

## Why

Four independent hygiene fixes to local/CI gates.

1. **The pre-commit hook could reformat files into a shape CI rejects.**
When a web directory had no `node_modules`, `scripts/pre-commit` fell
back to a floating `npx prettier` — prettier 3 against the `^2.8.8`
`web/frontend` pins and CI installs with `npm ci`. That rewrote
`getPlatformLink` in `web/frontend/src/app/apps/[id]/page.tsx` into a
CI-failing shape (#11304) and polluted four PRs in one day, plus
unrelated `app/` Dart files reformatted by a locally-installed Dart SDK
that differs from the repo's pinned Flutter.
2. **`web/frontend`'s test suite ran in no lane.** `package.json` has
`"test": "node --test src/__tests__/*.test.mjs"` with real guards
(`app-detail-not-found`, `case-status`,
`shared-conversation-chat-contract`), but `.github/checks-manifest.yaml`
never selected them — which is why a deleted frontend test's guards had
to be re-homed into a backend pytest to keep running.
3. **`web/admin/AGENTS.md` was 137 bytes from red.** `agents-md-lean`
going over budget takes `main` red and blocks every PR touching any
`AGENTS.md` (#11409, fixed by #11410).
4. **The pre-push backend test cap had an unbounded escape hatch.** The
root `AGENTS.md` push-gate budget says pre-push must "cap broad backend
selection at 40 files", and `scripts/pre-push` does cap it — but when
the selector overflows, the cap branch swaps in the diff's *own* changed
backend test files and never re-applies the cap to that replacement. A
diff changing more than 40 backend test files ran unbounded, while the
message still printed `cap is 40`. #11018's 92-file diff stalled its
push on this gate repeatedly; it had 15 changed backend test files so it
stayed under the cap, but slow enough that several agents resorted to
documented skip hatches — one size larger and there would have been no
bound at all.

## What changed

1. `scripts/pre-commit` resolves the pinned toolchain and **refuses to
format** rather than formatting with the wrong one: each web dir's
`package.json` prettier major must match `node_modules/.bin/prettier`,
and Dart requires the `flutter-version` pinned in
`.github/workflows/repo-checks.yml`. Both fallbacks (`npx`, global
`prettier`) are gone. Hatches: `OMI_SKIP_WEB_FORMAT=1`,
`OMI_SKIP_DART_FORMAT=1`, both documented in the root `AGENTS.md`
Formatting section. Web directories are now derived from the staged
paths, so `web/admin` (previously skipped entirely) is covered. New
regression test `scripts/test-pre-commit-pinned-toolchains.sh`,
registered as manifest check `pre-commit-pinned-toolchains`.
2. New manifest check `web-frontend-tests` (`local` + `ci`, triggers
`web/frontend/**`) running `node --test
'web/frontend/src/__tests__/**/*.test.mjs'` — the glob picks up test
files added later.
3. `web/admin/AGENTS.md` networking and revenue-metrics detail moved
verbatim into `web/admin/docs/data-contracts.md`, with the two top-level
rules and a pointer left behind. **Budgets untouched.**
4. The `scripts/pre-push` fallback now **truncates deterministically to
the cap**. The changed-test list is already `sort -u`ed, so `head -n
cap` picks the same files on every push of the same diff rather than
sampling a different subset. Truncation beats skipping here because the
diff's own changed test files are the highest-signal local coverage
available; the message now names the full changed-test count, what
actually ran, and points at `cd backend && bash test.sh` for the
remainder — it never prints a cap the run then exceeds.
`PRE_PUSH_MAX_BACKEND_UNIT_TEST_FILES` stays the single knob. New
regression test `scripts/test-pre-push-backend-test-cap.sh`, registered
as manifest check `pre-push-backend-test-cap` (`local` + `ci`). Distinct
lane from #11361, which narrows `flutter-codegen` selection in
`scripts/pre_push_ci_prediction.py` — same class of problem, no
overlapping files.

## Verification

**Mutation test of the new guard** — with `scripts/pre-commit` reverted
to `origin/main`, `scripts/test-pre-commit-pinned-toolchains.sh` fails
and the output shows the exact hazard:

```
FAIL: missing pinned prettier — hook exited 0 instead of refusing
Formatting staged web files with Prettier...
npm warn exec The following package was not found and will be installed: [email protected]
web/frontend/src/a.ts 34ms
```

With the fix applied: `pre-commit pinned-toolchain refusal tests passed`
(refusal cases for missing prettier, prettier major mismatch, no
flutter, flutter version mismatch; positive cases for the pinned
versions; and both hatches).

**Manifest selection** (`run_checks.py --list`):

| Diff | `web-frontend-tests` |
|---|---|
| `web/frontend/src/app/apps/x.tsx` | SELECTED |
| `web/frontend/src/__tests__/new-thing.test.mjs` | SELECTED |
| `backend/main.py` | not selected |

`run_checks.py --lane ci --check-id web-frontend-tests` → **47 tests
pass, 0 fail**.

**AGENTS.md headroom** after this PR (`python3
.github/scripts/check_agents_md_lean.py` → `ok: 7 AGENTS.md files within
budget`):

| File | Bytes | Headroom |
|---|---|---|
| `web/admin/AGENTS.md` | 457 / 1500 | **1043** |
| `AGENTS.md` | 17082 / 18000 | 918 |
| `.github/AGENTS.md` | 3825 / 4500 | 675 |
| `app/AGENTS.md` | 10606 / 11500 | 894 |
| `backend/AGENTS.md` | 38936 / 39000 | 64 |
| `desktop/macos/AGENTS.md` | 45531 / 47000 | 1469 |
| `omi/firmware/AGENTS.md` | 853 / 1500 | 647 |

`backend/AGENTS.md` remains 64 bytes from the same failure and still
needs its own PR.

**Mutation test of the pre-push cap bound** — the regression test
extracts the real `check_backend_unit_tests_if_needed` from the hook and
runs it against a stubbed selector and backend, so it exercises
production control flow rather than scraping source. With the bound
reverted:

```
FAIL: fallback ran 25 backend test file(s), over the cap of 10
Selector requested broad selector fallout (500 files; running 25 changed backend test file(s) instead; cap is 10).
Selected 25 backend unit test file(s): broad selector fallout
```

With the bound restored: `pre-push backend unit test cap tests passed`
(over-cap truncation, stable + sorted truncation across repeated runs,
the unchanged under-cap fallback message, and the unchanged
empty-fallback skip).

`make preflight` passes.

## Product invariants affected

none

## Failure class (fixes)

Failure-Class: none

The pre-push cap fix is likewise `none`: no registered class covers "a
bound's own fallback path must re-apply that bound", and one instance
does not justify opening one.

The nearest existing class, `FC-dev-fallback-masks-install-defect` (a
development-only fallback must never be the reason a check passes), is
scoped to packaged-app resource resolution on desktop; this is the same
shape in a different subsystem but the registry transition belongs in
its own PR.

🤖 Generated with [Claude Code](https://claude.com/claude-code)


<!-- This is an auto-generated description by cubic. -->
<a
href="https://cubic.dev/pr/BasedHardware/omi/pull/11413?utm_source=github"
target="_blank" rel="noopener noreferrer"
data-no-image-dialog="true"><picture><source
media="(prefers-color-scheme: dark)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"><source
media="(prefers-color-scheme: light)"
srcset="https://www.cubic.dev/buttons/review-in-cubic-light.svg"><img
alt="Review in cubic"
src="https://www.cubic.dev/buttons/review-in-cubic-dark.svg"></picture></a>
<!-- End of auto-generated description by cubic. -->

<!-- CURSOR_SUMMARY -->
---

> [!NOTE]
> **Low Risk**
> Changes are limited to git hooks, check manifest entries, and
devDependency/docs wiring; no production runtime or auth paths are
modified.
> 
> **Overview**
> Tightens local git hooks and CI manifest guards so formatting and
pre-push selection cannot silently diverge from what CI enforces.
> 
> **`scripts/pre-commit`** now **refuses** to auto-format when
toolchains do not match repo pins: web Prettier (and
`prettier-plugin-tailwindcss`) must match `package-lock.json` via local
`node_modules`; Dart uses the Flutter version from
`.github/workflows/repo-checks.yml` and that SDK’s `dart` binary.
Floating `npx`/global Prettier fallbacks are removed. Web dirs are
inferred from staged paths (so `web/admin` is included),
`*.generated.ts` is skipped, and format-and-add is blocked when a file
has unstaged edits. Escape hatches `OMI_SKIP_WEB_FORMAT=1` /
`OMI_SKIP_DART_FORMAT=1` are documented in root **`AGENTS.md`**.
> 
> **`scripts/pre-push`** re-applies
**`PRE_PUSH_MAX_BACKEND_UNIT_TEST_FILES`** when the broad-selector
fallback runs changed backend test files from the diff—deterministic
sorted truncation and clearer logging instead of an unbounded run that
still claimed a cap.
> 
> **`.github/checks-manifest.yaml`** adds
**`pre-commit-pinned-toolchains`**, **`pre-push-backend-test-cap`**, and
**`web-frontend-tests`** (`scripts/run-web-frontend-tests.sh` → `node
--test` on `web/frontend`).
> 
> **`web/admin/AGENTS.md`** is trimmed for the lean budget;
networking/revenue detail moves to
**`web/admin/docs/data-contracts.md`**. **`web/admin`** and
**`web/app`** pin Prettier ^2.8.8 (+ tailwind plugin) so the hook can
format them safely.
> 
> <sup>Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit
44dcc98. Configure
[here](https://www.cursor.com/dashboard/bugbot).</sup>
<!-- /CURSOR_SUMMARY -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

macOS no-changelog-needed Skip desktop changelog enforcement for internal-only changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants