Skip to content

docs(backend): restore agents-md-lean headroom for backend/AGENTS.md - #11411

Merged
undivisible merged 3 commits into
BasedHardware:mainfrom
undivisible:fix/backend-agents-md-headroom
Aug 12, 2026
Merged

undivisible merged 3 commits into
BasedHardware:mainfrom
undivisible:fix/backend-agents-md-headroom

Conversation

@undivisible

@undivisible undivisible commented Aug 11, 2026 •

Copy link
Copy Markdown
Collaborator

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

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

Review in cubic


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.

Reviewed by Cursor Bugbot for commit b7906af. Configure here.

@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_a9b30fb5-9a17-417e-8078-fb6be71b90bc)

@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.

All reported issues were addressed across 3 files

Reply with feedback, questions, or to request a fix.

Re-trigger cubic

Comment thread backend/AGENTS.md Resolved
@Git-on-my-level

Copy link
Copy Markdown
Member

Verified the move is verbatim — every deleted subservice bullet (pusher, llm_gateway, diarizer, agent-proxy, nllb_translation, modal) and all five memory-continuity gate rows reappear unchanged in backend/docs/subservice-internals.md and backend/docs/memory-continuity-gates.md, with accurate pointers left at backend/AGENTS.md:89 and :225. backend/AGENTS.md is now 35,829 bytes (3,171 bytes of headroom under the 39,000-byte ratchet) — good preventive headroom restoration.

Agent-context note: subservice internals and the memory-gate matrix are now just-in-time docs rather than always-loaded context. The pointers are clear and the content is faithful, so this is the intended agents-md-lean pattern — no information lost.

The PR Metadata Preflight failure is from desktop/macos/AGENTS.md (47,392 bytes over its 47,000 budget), which this PR does not touch; #11410 addresses that. This diff's own changes pass check_agents_md_lean for backend. Once the macos overage clears, this should merge cleanly.

— glm-5.2 maintainer review


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

@Git-on-my-level Git-on-my-level added positive-signal Automation verified a genuine fix/quality contribution docs-tooling Layer: Documentation, examples, dev tools labels Aug 11, 2026
@undivisible
undivisible force-pushed the fix/backend-agents-md-headroom branch from b7906af to dc16028 Compare August 12, 2026 12:21
@cursor

cursor Bot commented Aug 12, 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_5317eb89-c13f-4546-acdc-fba9ebe910ed)

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: dc16028f50

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".


| Gate | What it covers | What it does **not** cover |
| --- | --- | --- |
| **Hermetic pipeline E2E** (`testing/e2e/test_canonical_memory_pipeline.py`) | capture→consolidate→promote→read, archive excluded from default reads, surface default-access matrix, projection fail-closed without legacy bleed | Deployed revision identity, prod IAM/index deltas, live LLM consolidation |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use a valid path to the moved pipeline test

After moving this matrix under backend/docs/, testing/e2e/test_canonical_memory_pipeline.py resolves neither relative to this document nor from the repository root; the file is actually at backend/testing/e2e/test_canonical_memory_pipeline.py. Agents following the matrix therefore cannot reach the cited hermetic test, and this is no longer detected because check_agent_doc_references.py scans component AGENTS.md files and docs/agents/, not backend/docs/. Use the repository-relative path or keep the reference document in the checked agent-doc tree.

AGENTS.md reference: AGENTS.md:L143-L145

Useful? React with 👍 / 👎.

Comment thread backend/AGENTS.md
prompts.py # LLM prompt templates for memory extraction, categorization, etc.
translation.py # Multi-language translation coordination
speaker_identification.py # Speaker diarization + person matching against speech profiles
# Per-subservice internals: backend/docs/subservice-internals.md

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Ratchet the budget down after shrinking the guide

Moving this material removes roughly 3 KB from backend/AGENTS.md, but the commit leaves its check_agents_md_lean.py limit at 39,000 bytes. That check explicitly defines its limits as a downward ratchet and instructs that the budget be lowered in the same change when a guide shrinks; retaining the old limit lets future additions consume all reclaimed space without failing CI, defeating the preventive purpose of this commit. Lower the backend line/byte limits alongside the move.

AGENTS.md reference: AGENTS.md:L143-L145

Useful? React with 👍 / 👎.

@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.

Reviewed as glm-5.2. Approving — this is a clean, verbatim docs relocation that restores CI headroom.

Per-file observations:

  • backend/AGENTS.md (+3/-30): Two content blocks removed and replaced with pointers. The per-subservice internal bullets (pusher, diarizer, agent-proxy, nllb_translation, modal) are replaced by 'Per-subservice internals: backend/docs/subservice-internals.md' pointers in the directory tree, and the five-row memory-continuity gauntlet gate table is replaced by 'Gate-by-gate coverage matrix: backend/docs/memory-continuity-gates.md'. The Service Map (inter-service call graph, deploy/runtime contracts) and all setup/test/async/logging-security rules remain inline — correct, since those are what agents read most frequently.

  • backend/docs/subservice-internals.md (new, +41): Verbatim copy of the removed per-subservice bullets, wrapped in a fenced code block with a header explaining the move and the size-ratchet rationale. Content matches the removed lines exactly, including the agent-proxy keepalive (120s), AES-256-GCM encryption note, and nllb Gemini fallback.

  • backend/docs/memory-continuity-gates.md (new, +19): Verbatim copy of the removed five-row gate coverage table, with a self-contained header ('Do not confuse these gates...') and the CI self-check note. The 'never fake GO' line is correctly preserved in both this doc and the AGENTS.md pointer context.

Agent-behavior note: these are agent-instruction files, so the relocation affects what AI coding/review agents see when they load backend/AGENTS.md — they now get pointers instead of inline subservice/gate detail and must follow the links for that information. The guidance content itself is unchanged (verified verbatim), so there is no behavioral change to what agents should do.

Verified: check_agents_md_lean.py passes at this head (7 AGENTS.md files within budget), content is byte-for-byte moved with no paraphrasing or silent drops, and all backend checks (Hermetic Merge Gate, Backend E2E, Sync Cloud Tasks Gauntlet, Listen Pusher Gauntlet) are green.

Thanks for the proactive fix — being one sentence away from breaking the lean ratchet on main would have blocked every AGENTS.md-touching PR.


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 force-pushed the fix/backend-agents-md-headroom branch from dc16028 to b7906af Compare August 12, 2026 13:47
@cursor

cursor Bot commented Aug 12, 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_2439106c-b243-4689-a34f-50cc30d43706)

backend/AGENTS.md had 64 bytes of headroom under its 39,000-byte
agents-md-lean budget. Moves the per-subservice internal bullets (pusher,
diarizer, agent-proxy, nllb_translation, modal) out of the Directory
Structure tree into backend/docs/subservice-internals.md verbatim, leaving
one line per subservice plus a pointer. Nothing is dropped; the Service Map
and its deploy contracts stay in AGENTS.md.
The five-row gauntlet gate coverage table is rarely-needed rollout
reference. Moves it verbatim to backend/docs/memory-continuity-gates.md,
keeping the do-not-confuse rule, the CI self-check line, and the NOT_RUN
rule in AGENTS.md with a pointer.
@undivisible
undivisible force-pushed the fix/backend-agents-md-headroom branch from b7906af to 5baeeea Compare August 12, 2026 14:42
@undivisible
undivisible merged commit 1ca4010 into BasedHardware:main Aug 12, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs-tooling Layer: Documentation, examples, dev tools positive-signal Automation verified a genuine fix/quality contribution

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants