longwave-ai-lab/agentic-workflow-os

Agentic Workflow OS: Deterministic /boost Context-Bloat Pruner, /teamwork-preview Git Worktree Sandbox, /goal Anti-Rewar

Stars 0 Language JavaScript Last updated 2026-10-30 Source on GitHub @longwave-ai-lab

Actual rules from this repo

Path in source repo: .cursor/rules/01-boost-context-bloat-optimizer.mdc · format: mdc

---
description: "Enforces /boost context-window hygiene: <= 200 line root constitutions (CLAUDE.md/GEMINI.md), 3-tier lazy-loaded .mdc and SKILL.md sharding, subagent search offloading, 60% context compaction, and .boost-context-budget.json verification."
globs: "**/*"
alwaysApply: true
---
# Module 01: Context-Bloat & Token-Pruner Protocol (`RULE-BOOST-CONTEXT-OPTIMIZER`)

> **Severity**: `BLOCKING` | **Scope**: Root Constitutions (`CLAUDE.md`, `GEMINI.md`), Scoped Rules (`.cursor/rules/*.mdc`), Skills (`SKILL.md`), & Context Hygiene  
> **Platforms**: Google Antigravity (`GEMINI.md`), Cursor IDE (`.cursor/rules/*.mdc`), Claude Code (`CLAUDE.md` / `SKILL.md`), ChatGPT Projects

---

## 1. Core Constitutional Invariants (Nguyên Tắc Bất Biến)

### 🇬🇧 English Specification
1. **Zero Monolithic Prompt Stuffing (`200-Line Root Constitution Cap`)**:
   - Whenever an agent initializes a workspace, audits token usage via `/boost`, or adds a new engineering rule, it is **STRICTLY FORBIDDEN** to dump encyclopedic documentation, raw API schemas, or edge-case tutorials into root instruction files (`CLAUDE.md`, `GEMINI.md`, `.cursorrules`).
   - Root instruction files load on every single turn and consume primary attention heads. Keep every root constitution file strictly at or below **200 lines** (`<= 1,800 tokens`) so the model retains over **90% active reasoning capacity** for live code and user intent.
   - When a root constitution file approaches 180 lines, extract domain-specific sections into dedicated `.cursor/rules/*.mdc` or `.claude/skills/*/SKILL.md` files before adding a single new line (`One-In, Consolidation-Out`). Before adding any new rule or script, evaluate **Option 0 (Keep Current State)** across 5 Lean-Harness questions to confirm that existing gates do not already catch the bug.
2. **Step 1 - Progressive Disclosure & Lazy-Loaded Skill Sharding**:
   - Partition workspace rules into a 3-tier attention hierarchy before writing new instructions:
     - **Tier A - Root Constitution (`CLAUDE.md` / `GEMINI.md` <= 200 lines)**: Global architectural invariants, build/test commands, and high-level routing pointers only.
     - **Tier B - Path-Scoped Cursor Rules (`.cursor/rules/*.mdc`)**: Domain rules restricted by explicit `globs` (for example `src/components/**/*.tsx` or `scripts/**/*.mjs`) with `alwaysApply: false` unless the rule governs universal safety.
     - **Tier C - On-Demand Agent Skills (`.claude/skills/*/SKILL.md` & `.agents/skills/*/SKILL.md`)**: Deep workflows, reference tables, and verification scripts loaded lazily only when the active task matches the skill trigger description.
3. **Step 2 - Subagent Search Offloading & Context Compaction**:
   - Never run broad directory walks, unfiltered `grep` dumps, or multi-megabyte log reads inside the primary orchestrator thread.
   - Offload exploratory file searches, dependency audits, and log triage to isolated subagents or targeted ripgrep queries capped at 50 matches. Return only a concise structured summary (`<= 300 tokens`) to the main thread.
   - Trigger `/compact` or summarize completed sub-tasks whenever active context utilization crosses **60% of the model context window** to prevent middle-curve attention dilution.
4. **Step 3 - Heavy Directory Exclusion & Verifiable Budget Receipt**:
   - Configure `.cursorignore` and `.claudeignore` to block high-volume, low-signal directories (`node_modules/`, `dist/`, `build/`, `.next/`, `coverage/`, `package-lock.json`, `pnpm-lock.yaml`, `*.min.js`).
   - Before concluding any `/boost` optimization pass, write a deterministic audit receipt to `.boost-context-budget.json` recording root file line counts, glob coverage across `.mdc` rules, excluded heavy directories, and estimated token savings.

### 🇻🇳 Đặc Tả Tiếng Việt
1. **Cấm Nhồi Nhét File Cấu Hình Gốc (`Trần 200 Dòng Cho File Gốc`)**:
   - Khi AI khởi tạo dự án hoặc chạy lệnh `/boost` để dọn dẹp ngữ cảnh, **CẤM TUYỆT ĐỐI** nhồi tài liệu dài dòng vào file gốc. Bạn không được chép bảng dữ liệu thô hay hướng dẫn chi tiết vào `CLAUDE.md`, `GEMINI.md` hoặc `.cursorrules`.
   - File cấu hình gốc luôn tự động nạp vào bộ nhớ ở mọi lượt hội thoại. Bạn phải giữ file gốc gọn dưới **200 dòng** (`<= 1.800 token`) để mô hình dành trọn **trên 90% năng lượng chú ý** cho mã nguồn thực tế.
   - Khi file cấu hình gốc chạm mốc 180 dòng, bạn bắt buộc phải tách các hướng dẫn chuyên ngành sang thư mục `.cursor/rules/` hoặc `.claude/skills/` trước khi viết thêm luật mới (`One-In, Consolidation-Out`). Trước khi thêm bất kỳ quy tắc hay công cụ nào, luôn đối chiếu **Phương án 0 (Giữ nguyên hiện trạng)** để tránh làm phình bộ khung kiểm soát.
2. **Bước 1 - Phân Tầng Nạp Chậm Theo Ngữ Cảnh (`3-Tier Lazy Loading`)**:
   - Chia nhỏ hệ thống quy tắc thành 3 tầng rõ rệt thay vì gom chung một chỗ:
     - **Tầng A - Hiến Pháp Gốc (`CLAUDE.md` / `GEMINI.md` <= 200 dòng)**: Chỉ chứa nguyên tắc sống còn, lệnh chạy kiểm thử và danh mục điều hướng ngắn gọn.
     - **Tầng B - Luật Theo Đường Dẫn File (`.cursor/rules/*.mdc`)**: Gắn bộ lọc đường dẫn `globs` cụ thể (như `src/ui/**/*.tsx`) để chỉ nạp luật khi chạm đúng thư mục đó.
     - **Tầng C - Kỹ Năng Chuyên Biệt Nạp Khi Cần (`SKILL.md`)**: Tách các quy trình dài, bảng tham chiếu và công cụ kiểm tra vào thư mục kỹ năng riêng để AI chỉ mở ra đọc khi đúng việc.
3. **Bước 2 - Cách Ly Tác Vụ Tìm Kiếm Nặng Sang Luồng Phụ (`Subagent Offloading`)**:
   - Không chạy lệnh quét toàn bộ ổ đĩa hoặc đọc file nhật ký hàng chục nghìn dòng ngay trong luồng trò chuyện chính.
   - Hãy giao việc dò tìm file hoặc lọc lỗi nhật ký cho một luồng tác vụ phụ độc lập. Luồng phụ chỉ trả về bản tóm tắt kết quả ngắn gọn dưới **300 token** cho luồng chính.
   - Chủ động nén lịch sử trò chuyện ngay khi dung lượng bộ nhớ chạm ngưỡng **60% giới hạn cửa sổ ngữ cảnh** để tránh hiện tượng quên đầu quên đuôi.
4. **Bước 3 - Chặn Thư Mục Rác & Xuất Biên Bản Kiểm Toán (`Context Budget Receipt`)**:
   - Thiết lập file `.cursorignore` và `.claudeignore`

Content truncated. View full file in the source repo (linked above).

View raw on GitHub

Why this is listed

This repository appears on Cursor Rules Live because it matches the tracker's GitHub Search criteria (cursor-rules) and was active in the recent indexing window. The tracker refreshes every 15 minutes, so the metadata above reflects the state at the most recent index pass. If the data here looks stale, the source repository may have been archived or moved out of the tracked topic; the next cron tick will reconcile.

Similar in this tracker

Explore by category