Skip to content

docs(openspec): 放寬 root CLAUDE.md 行數預算 100→130(目標 80→100) - #199

Merged
monkey1sai merged 1 commit into
mainfrom
codex/raise-claude-md-line-budget
Jun 10, 2026
Merged

monkey1sai merged 1 commit into
mainfrom
codex/raise-claude-md-line-budget

Conversation

@monkey1sai

@monkey1sai monkey1sai commented Jun 10, 2026 •

Copy link
Copy Markdown
Owner

摘要

放寬 root CLAUDE.md 的行數預算硬上限:100 → 130 行(目標 80 → 100)。AGENTS.md(250 / 200)不變。

為什麼

  • 追蹤檔 CLAUDE.md 本體 77 行,wc -l 閘門本來就沒超標。
  • 但 GitNexus code-intelligence 工具每次 session 載入時在 CLAUDE.md 檔尾自動附加「# GitNexus — Code Intelligence」區塊(約 42 行),實際載入約 119 行 → 超過 100 行精神上限(spec 在意的是「長度直接乘上每次 session token 成本」的真實載入量)。
  • 放寬至 130 讓上限對齊真實載入成本並留約 10 行 headroom;並明寫 wc -l 閘門量追蹤檔本體、GitNexus runtime 附加區塊另計。

變更

  • MODIFIED spec agent-doc-context-budget(canonical 直接 pre-apply + change folder delta 同步記錄;未來 convergence archive-only,同 docs-design 模式)。
  • AGENTS.md / CLAUDE.md 預算自述句對齊 130 / 100(本體內容不變、仍 77 行)。
  • 附 active OpenSpec change raise-claude-md-line-budget(proposal / tasks / delta)說明放寬理由。

驗證

  • 結構驗證:wc -l CLAUDE.md = 77 ≤ 130、AGENTS.md = 212 ≤ 250、無殘留舊上限、git diff --check clean、canonical == delta。
  • 本機 OpenSpec CLI 不可用(could not determine executable to run)→ openspec validate --specs --strict 待 CI pr-review-agent 補綠。

範圍註記

subfolder-agent-boundary-coverage 的 sub-folder AGENTS.md / sub-repo CLAUDE.md 100 行上限是另一獨立 budget,本 PR 不動(如需一併放寬可另開 change)。

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Documentation
    • Updated context budget specifications for agent configuration files with increased line limits.
    • Added formal specification for agent session context governance and line-counting rules.
    • Updated related documentation and task tracking for context budget management.

agent-doc-context-budget 對 root CLAUDE.md 的硬上限自 100 放寬至 130 行
(目標 80→100)。理由:追蹤檔 CLAUDE.md 本體 77 行未超標,但 GitNexus
code-intelligence 工具每次 session 在檔尾自動附加約 42 行區塊,實際載入
約 119 行、超過 100 行精神上限。放寬後上限對齊真實載入成本並留約 10 行
headroom;同時明寫 wc -l 閘門量追蹤檔本體、runtime 附加區塊另計。

- MODIFIED spec agent-doc-context-budget(canonical 已 pre-apply,change
  delta 同步記錄;未來 convergence archive-only,同 docs-design 模式)
- AGENTS.md / CLAUDE.md 預算自述句對齊 130/100(本體內容不變、仍 77 行)
- AGENTS.md 預算 250/200 不變;subfolder-agent-boundary-coverage 的
  sub-folder 100 上限為另一獨立 budget,本 change 不動

本機 openspec CLI 不可用 → 結構驗證過(wc -l 77≤130、無殘留、diff --check
clean、canonical==delta);openspec validate --specs --strict 待 CI 補綠。

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 10, 2026 03:21
@coderabbitai

coderabbitai Bot commented Jun 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 6173d5e8-9581-4487-9dfa-35aa4f191b17

📥 Commits

Reviewing files that changed from the base of the PR and between e3d98fe and 2f53a31.

📒 Files selected for processing (6)
  • AGENTS.md
  • CLAUDE.md
  • openspec/changes/raise-claude-md-line-budget/proposal.md
  • openspec/changes/raise-claude-md-line-budget/specs/agent-doc-context-budget/spec.md
  • openspec/changes/raise-claude-md-line-budget/tasks.md
  • openspec/specs/agent-doc-context-budget/spec.md

📝 Walkthrough

Walkthrough

This PR raises the line budget enforcement limits for CLAUDE.md from 100 (target 80) to 130 (target 100) lines, updates the agent-doc-context-budget specification with explicit review scenarios and measurement rules, and synchronizes policy documents and verification tasks to the new constraints.

Changes

Context Budget Governance Update

Layer / File(s) Summary
Budget specification and review governance
openspec/changes/raise-claude-md-line-budget/proposal.md, openspec/changes/raise-claude-md-line-budget/specs/agent-doc-context-budget/spec.md
Proposal explains raising CLAUDE.md limits (100→130, target 80→100) and clarifies that wc -l measures file body only while GitNexus appends runtime blocks separately. New spec draft defines root entrypoint budget constraints, wc -l measurement methodology, and PR review scenarios: exceeding limits requires refactoring or variance, pure link fixes pass through, and AGENTS.md limits remain unchanged.
Updated agent-doc-context-budget specification
openspec/specs/agent-doc-context-budget/spec.md
Main spec is updated to enforce CLAUDE.md hard cap at 130 lines (target 100), clarify wc -l measurement excluding GitNexus runtime blocks, and adjust PR scenario thresholds and review requirements to the new gate.
Policy document and verification updates
AGENTS.md, CLAUDE.md, openspec/changes/raise-claude-md-line-budget/tasks.md
AGENTS.md and CLAUDE.md budget statements are synchronized to reflect new CLAUDE.md limits (≤130/target≤100). Task checklist documents OpenSpec spec updates, verification commands (wc -l assertions, trailing whitespace, pending strict validation), and expected results confirming compliance.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related PRs

  • monkey1sai/AI-BIM-governance#122: Prior update to the same agent-doc-context-budget rules governing root CLAUDE.md line gates and AGENTS.md consistency, making it directly connected at the spec-and-governance level.

Poem

🐰 A budget raised, a limit loose,
CLAUDE.md gains room for thoughts!
From hundred lines to one-thirty,
The rabbit celebrates the spec reshuffle—
More context, less constraint! 🎉

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately and specifically describes the main change: raising the CLAUDE.md line budget from 100→130 lines with target 80→100.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch codex/raise-claude-md-line-budget

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR relaxes the root CLAUDE.md line-count budget from 100 → 130 (target 80 → 100) in the agent-doc-context-budget spec. The motivation is that GitNexus code-intelligence appends ~42 lines at session load time, pushing the actual loaded content (~119 lines) beyond the old 100-line spirit limit. The wc -l gate still measures only the tracked file body (currently 77 lines); the spec now explicitly documents that runtime-appended blocks are excluded from the gate.

Changes:

  • Updated the canonical spec and its delta in the change folder to reflect the new 130/100 limits, and clarified the wc -l measurement scope.
  • Updated CLAUDE.md and AGENTS.md self-referencing budget sentences to match the new limits.
  • Added a complete OpenSpec change (raise-claude-md-line-budget) with proposal, tasks, and delta spec documenting the rationale.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
openspec/specs/agent-doc-context-budget/spec.md Canonical spec: CLAUDE.md limit 100→130, target 80→100; clarifies GitNexus blocks excluded from gate
openspec/changes/raise-claude-md-line-budget/proposal.md New change proposal explaining the rationale for the budget increase
openspec/changes/raise-claude-md-line-budget/tasks.md Task checklist tracking spec update, self-ref updates, and validation
openspec/changes/raise-claude-md-line-budget/specs/agent-doc-context-budget/spec.md Delta spec mirroring the canonical spec's modified requirement
CLAUDE.md Budget self-reference updated to ≤ 130 / target ≤ 100
AGENTS.md Budget self-reference updated to CLAUDE.md ≤ 130 / target ≤ 100

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

- `CLAUDE.md` SHALL 不超過 **130 行**(目標 ≤ 100 行)。

行數以 LF 行尾 + `wc -l` 為準。任何 PR 若導致兩檔回胖超過上限,必須在 PR 描述說明原因並附對應 OpenSpec change,否則 review 應要求拆分到 `docs/agents/*.md` sub-file。
行數以 LF 行尾 + `wc -l` 為準(量 repo 追蹤檔本體;GitNexus 等工具於 session 載入時自動附加至檔尾的區塊**另計**,不在本 `wc -l` 閘門範圍內)。`CLAUDE.md` 上限自 100 放寬至 130(目標 80 → 100),係反映 GitNexus code-intelligence 區塊每次 session 自動附加(約 42 行)後的真實載入成本,並保留約 10 行 headroom;目標仍鼓勵作者本體 ≤ 100 行。任何 PR 若導致兩檔回胖超過上限,必須在 PR 描述說明原因並附對應 OpenSpec change,否則 review 應要求拆分到 `docs/agents/*.md` sub-file。

@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: 2f53a31d30

ℹ️ 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".

- `CLAUDE.md` SHALL 不超過 **130 行**(目標 ≤ 100 行)。

行數以 LF 行尾 + `wc -l` 為準。任何 PR 若導致兩檔回胖超過上限,必須在 PR 描述說明原因並附對應 OpenSpec change,否則 review 應要求拆分到 `docs/agents/*.md` sub-file。
行數以 LF 行尾 + `wc -l` 為準(量 repo 追蹤檔本體;GitNexus 等工具於 session 載入時自動附加至檔尾的區塊**另計**,不在本 `wc -l` 閘門範圍內)。`CLAUDE.md` 上限自 100 放寬至 130(目標 80 → 100),係反映 GitNexus code-intelligence 區塊每次 session 自動附加(約 42 行)後的真實載入成本,並保留約 10 行 headroom;目標仍鼓勵作者本體 ≤ 100 行。任何 PR 若導致兩檔回胖超過上限,必須在 PR 描述說明原因並附對應 OpenSpec change,否則 review 應要求拆分到 `docs/agents/*.md` sub-file。

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 Keep the runtime-appended block inside the true-load budget

When a future PR grows tracked CLAUDE.md to the newly allowed 130 lines, the GitNexus block that this paragraph says is appended on every session still adds about 42 more lines, so the actual session-loaded entrypoint becomes ~172 lines rather than the stated 130-line budget with ~10 lines of headroom. Because the requirement’s purpose is to bound the real per-session token cost, excluding the runtime block from the wc -l gate while raising the tracked-file cap lets later changes pass the gate even though they exceed the true-load budget this change is meant to enforce.

Useful? React with 👍 / 👎.

@github-actions

Copy link
Copy Markdown
Contributor

PR Review Agent Summary

Field Value
Status passed
Risk low
PR 199
Head codex/raise-claude-md-line-budget / 2f53a31d30f79c464bc3c6a594691d6a688b8bd6
Base main / e3d98fedbd9b8cae4146e690aa7c833dd21f9170

Blockers

  • None

Warnings

  • None

Validation Commands

  • openspec validate --specs --strict
  • openspec validate raise-claude-md-line-budget

Checks

  • passed openspec validate --specs --strict (openspec)
  • passed openspec validate raise-claude-md-line-budget (openspec)

Human Review Notes

  • OpenSpec changes detected: raise-claude-md-line-budget
  • Optional AI adapter is not required by policy and was skipped.

@monkey1sai
monkey1sai merged commit fc17b57 into main Jun 10, 2026
3 checks passed
@monkey1sai
monkey1sai deleted the codex/raise-claude-md-line-budget branch June 10, 2026 03:28
monkey1sai added a commit that referenced this pull request Jun 18, 2026
#229)

把 13 個產品碼已 merge 進 main 的 active change 歸檔為不可變快照,
並將其 spec delta 併入 canonical specs。對齊 #197 收斂規約。

歸檔(archive/<merge-date>-<id>,git 偵測為 R100 純改名、零內容漂移):
  a1-m1-closeout(#213) a2-version-diff-selector(#207) conv-coverage-report(#218/#220)
  conv-prioritize-retry(#221) conv-watch-toggle(#225) conversion-artifact-id-sanitize(#206)
  governance-service-deploy(#215) minio-fileserver-source(#204) minio-watch-auto-intake(#210)
  raise-claude-md-line-budget(#199) sessions-terminate(#226) stop-all-single-pid-cleanup(#217)
  test-deploy-rebuild-workflow(#198)

canonical 併入:
- 9 個新 capability(純 ADDED → 新建 spec):a1-m1-closeout、a2-version-diff-selector、
  conv-coverage-report、conv-prioritize-retry、conversion-control、conversion-artifact-id-sanitize、
  minio-fileserver-source、minio-watch-auto-intake、test-deploy-rebuild-workflow。
- review-session-request-lifecycle:append sessions-terminate 的 ADDED requirement
  「Operator 結束 session controlled action」(5 scenario),既有 7 requirement 不動。
- one-click-deploy-hybrid:併入 governance-service-deploy 與 stop-all-single-pid-cleanup
  兩 delta,採「合併不取代」保全既有更豐富內容。依 deploy.ps1 現況權威
  (4a=governance/4b=conversion/4c=Kit/4d=docker)調和 Phase 4 編號,並修正
  canonical 其他兩處陳舊的舊 3 段編號(Mode C 入口 scenario、退出碼 stage 清單補 4d)。
- agent-doc-context-budget:raise-claude-md-line-budget 的 130 行預算已於 #199 併入,
  本次為 archive-only。

驗證:
- 結構檢查無殘留 ## ADDED/MODIFIED header、每 requirement 皆有 scenario、
  43 archive 檔全 R100、git diff --cached --check 無 whitespace。
- 雙 agent 對抗驗證:完整性 PASS(無規範遺失);一致性初判 FAIL 抓到 2 處
  Phase 4 編號矛盾,已修正後複驗。
- 本機 openspec CLI 不可用(結構驗證代替);openspec validate --strict 由 CI pr-review-agent 執行。


Claude-Session: https://claude.ai/code/session_01JEyNWhEmb3x8oinY3B2v9V

Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants