| name | exclude-wiki-claude-md-from-harness-line-limit-hook |
| description | Fix false-positive pre-commit failures where workspace-hub's CLAUDE.md line-limit hook blocks edits to auto-generated wiki schema files under knowledge/wikis/. |
| version | 1.0.0 |
| author | Hermes Agent |
Exclude wiki CLAUDE.md files from harness line-limit hook
Use this when a commit is blocked by .claude/hooks/check-claude-md-limits.sh after editing wiki-domain CLAUDE.md files under knowledge/wikis/.
Problem
Workspace-hub has a hook intended to enforce short harness adapter docs (CLAUDE.md, AGENTS.md, etc.).
The hook pattern is too broad and also matches wiki schema/config files generated by llm-wiki init, which are often ~90+ lines.
Typical symptom:
- a commit touching
knowledge/wikis/<domain>/CLAUDE.md fails even for a tiny valid edit
- the hook treats those files like top-level harness adapter files with a strict line cap
Root cause
In .claude/hooks/check-claude-md-limits.sh, the staged-file filter matches all CLAUDE.md paths:
HARNESS_PATTERN='(^|/)?(CLAUDE|MEMORY|AGENTS|GEMINI)\.md$'
STAGED=$(git diff --cached --name-only --diff-filter=ACMR 2>/dev/null | grep -E "$HARNESS_PATTERN" || true)
That unintentionally includes knowledge/wikis/**/CLAUDE.md.
Minimal safe fix
Exclude wiki-generated CLAUDE files from the staged-file set:
STAGED=$(git diff --cached --name-only --diff-filter=ACMR 2>/dev/null | grep -E "$HARNESS_PATTERN" | grep -v '^knowledge/wikis/' || true)
When this fix is appropriate
Apply it when:
- the blocked files are under
knowledge/wikis/
- they are wiki schema/config files, not harness adapter files
- the commit only needs normal wiki-context updates (for example adding architecture context links)
Do NOT apply this as a blanket exemption for unrelated CLAUDE.md files elsewhere.
Recommended workflow
- Confirm the blocked files are only wiki CLAUDE files.
- Check what is already staged with
git diff --cached --name-only.
- Patch
.claude/hooks/check-claude-md-limits.sh with the exclusion above.
- Commit carefully:
- if the wiki files are already staged from the failed attempt, the hook-fix commit may also include those files unless you unstage them first
- if you want two separate commits, run
git restore --staged <wiki-files> before committing the hook fix
- if a bundled commit is acceptable, document that the hook fix and blocked wiki-file cleanup landed together
- Re-run or finish the intended commit/push flow as needed.
- Post a short GitHub follow-up comment if the cleanup was tied to a closed issue.
Why this is reusable
This is not a one-off content bug; it is a structural mismatch between:
- short harness adapter docs
- long wiki schema/config docs generated under
knowledge/wikis/
Any future edits to wiki CLAUDE.md files can hit the same false positive unless the hook excludes them.
Example outcome
This fix was used successfully when closing residual work from #2104, where two wiki CLAUDE.md files already had the correct architecture-context lines in the working tree but could not be committed because of the false-positive line-limit hook.