Restore Brooks-Lint as mandatory L0 with receipt proof and skill pack. - #49
Restore Brooks-Lint as mandatory L0 with receipt proof and skill pack.#49shi275773124 wants to merge 1 commit into
Conversation
Claim-bearing review/run now default-run Phase-0 Brooks-Lint, emit a brooks_lint receipt block, and fail closed without l0_brooks_ran so structural audit cannot be skipped for PASS. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
Falsify Review (L2 lint)
Falsify gate — tier= No changed .md files in this PR. kernel=falsify.authority_kernel.finalize_authority; L2 lint is not production/quant authority. Powered by |
📝 WalkthroughWalkthroughChangesBrooks-Lint is introduced as the L0 framework audit before adversarial review. The CLI records L0 receipts and findings, enforces L0 obligations for claim-bearing review/run commands, adds a standalone Brooks-Lint L0 integration
Estimated code review effort: 4 (Complex) | ~60 minutes 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
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. Comment |
There was a problem hiding this comment.
Actionable comments posted: 5
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@docs/ROOTFIX-architecture.md`:
- Around line 164-168: Update the shared authority-boundary documentation to
identify standalone falsify brooks/cmd_brooks output as L0-only evidence: it may
emit a brooks_lint receipt and 0/1 exit, but does not provide the
authority-kernel verdict, claim_scope, or authority_ceiling supplied by
review/run. Apply this clarification in docs/ROOTFIX-architecture.md lines
164-168, docs/17-skills.md line 18, docs/17-skills.zh-CN.md line 18, and
skills/falsify-brooks-lint/templates/input.md line 27, preserving the
distinction that review/run are the complete Claiming Falsify exit.
In `@falsify/cli.py`:
- Around line 611-614: Restrict the fallback in the status-parsing flow around
the `status == "ERROR"` branch to recognize only a near-miss terminal status
line indicating scope refusal, not arbitrary prose in `raw`. Replace the loose
`re.search` pattern with validation anchored to the expected terminal-line
format, preserving `SCOPE_REFUSED` and `ran=True` only when that explicit
near-miss line is present; otherwise leave malformed output as not ran.
In `@skills/falsify-brooks-lint/references/common.md`:
- Around line 65-66: Update skills/falsify-brooks-lint/references/common.md
lines 65-66 to load custom-risks-guide.md from the pack-local references/
directory. In skills/falsify-brooks-lint/references/chris-improvements.md lines
126-135, replace each _shared/common.md, _shared/chris-improvements.md, and
_shared/decay-risks.md reference with its corresponding pack-local references/
path.
In `@skills/falsify-brooks-lint/SKILL.md`:
- Around line 1-14: Add a version note to the skill contract metadata in
falsify-brooks-lint, using the current skill version (for example, v0.9.11).
Place it alongside the existing Provenance fields and ensure it identifies this
revision of the Evidence Gate, verdict, and receipt semantics.
- Around line 69-74: Update the Verdict Rules defining PASS and PASS_WITH_DEBT
so they are mutually exclusive: require PASS to have no Known Debt items, while
reserving PASS_WITH_DEBT for one or more Known Debt items with explicit upgrade
triggers. Preserve the existing Must Fix and structural-audit requirements.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro Plus
Run ID: edf8a5f4-441e-48cf-9b6b-5f4d9f213e7a
📒 Files selected for processing (26)
README.mdREADME.zh-CN.mddocs/01-architecture.mddocs/01-architecture.zh-CN.mddocs/09-brooks-lint.mddocs/17-skills.mddocs/17-skills.zh-CN.mddocs/ROOTFIX-architecture.mdfalsify/authority_kernel.pyfalsify/cli.pyskills/README.mdskills/falsify-brooks-lint/README.mdskills/falsify-brooks-lint/SKILL.mdskills/falsify-brooks-lint/references/chris-improvements.mdskills/falsify-brooks-lint/references/common.mdskills/falsify-brooks-lint/references/custom-risks-guide.mdskills/falsify-brooks-lint/references/decay-risks.mdskills/falsify-brooks-lint/references/pr-review-guide.mdskills/falsify-brooks-lint/references/remedy-guide.mdskills/falsify-brooks-lint/references/source-coverage.mdskills/falsify-brooks-lint/templates/input.mdskills/falsify-brooks-lint/templates/verdict.schema.jsontests/test_authority_kernel.pytests/test_brooks_lint_receipt.pytests/test_falsify_core.pytools/check_authority_wiring.py
| | 层 | 权威出口 / 工具 | 说明 | | ||
| |----|-----------------|------| | ||
| | **L0** Brooks-Lint(框架审) | `python -m falsify review` / `run`(默认)· `python -m falsify brooks` · pack `skills/falsify-brooks-lint/` | 结构腐烂 / 可审计性;回执必须有 `brooks_lint` 证明块 | | ||
| | **L1** Adversarial | 同 review 路径的攻击腿 | 可选攻击器,不是信任根 | | ||
| | **L2** markdown lint | `python -m falsify lint` / `gate` stub | **不是** Brooks-Lint;仅标签/阻断器静态检查 | |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
🧩 Analysis chain
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== repo files of interest =="
git ls-files | rg '(^docs/ROOTFIX-architecture\.md$|^docs/17-skills(\.zh-CN)?\.md$|^skills/falsify-brooks-lint/templates/input\.md$|falsify|skills/falsify)' || true
echo
echo "== relevant documentation snippets =="
for f in docs/ROOTFIX-architecture.md docs/17-skills.md docs/17-skills.zh-CN.md skills/falsify-brooks-lint/templates/input.md; do
if [ -f "$f" ]; then
echo "--- $f ---"
nl -ba "$f" | sed -n '1,80p'
fi
done
echo
echo "== brooks/review/lint command symbols =="
rg -n "cmd_brooks|falsify brooks|falsify review|falsify lint|authority_ceiling|claim_scope|verdict|brooks_lint|Claiming Falsify" -S . --glob '!**/.git/**' || true
echo
echo "== locate likely command implementation files =="
git ls-files | rg '(\.py$|\.js$|\.ts$|\.yaml$|\.yml$|\.json$)' | rg -i '(falsify|brooks|review|lint|command|cli)' || trueRepository: shi275773124/Falsify
Length of output: 50378
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== relevant docs snippets =="
for f in docs/ROOTFIX-architecture.md docs/17-skills.md docs/17-skills.zh-CN.md skills/falsify-brooks-lint/templates/input.md; do
if [ -f "$f" ]; then
echo "--- $f ---"
nl -ba "$f" | sed -n '1,80p'
fi
done
echo
echo "== core falsify files =="
for f in falsify/__main__.py falsify/__init__.py falsify/audit_backtest.py; do
if [ -f "$f" ]; then
echo "--- outline $f ---"
ast-grep outline "$f" --view compact || true
echo "--- first 260 lines $f ---"
nl -ba "$f" | sed -n '1,260p'
fi
done
echo
echo "== authority/verdict field usages =="
rg -n --hidden --glob '!falsify/audit_backtest_fixtures/**' --glob '!**/.git/**' \
"cmd_brooks|falsify brooks|falsify review|falsify lint|authority_ceiling|claim_scope|verdict|receipt|brooks_lint|Claiming Falsify|CLAIMING|claim-bearing|authoritative|authority" \
-S . || trueRepository: shi275773124/Falsify
Length of output: 264
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== relevant docs snippets -- sed 1,100 =="
for f in docs/ROOTFIX-architecture.md docs/17-skills.md docs/17-skills.zh-CN.md skills/falsify-brooks-lint/templates/input.md; do
if [ -f "$f" ]; then
echo "--- $f ---"
sed -n '1,100p' "$f" | nl 2>/dev/null || cat -n "$f" | sed -n '1,100p'
fi
done
echo
echo "== core falsify files -- sed 1,300 =="
for f in falsify/__main__.py falsify/__init__.py falsify/audit_backtest.py; do
if [ -f "$f" ]; then
echo "--- $f ---"
sed -n '1,300p' "$f" | nl 2>/dev/null || cat -n "$f" | sed -n '1,300p'
fi
done
echo
echo "== targeted commands/usages -- max 100 matches =="
rg -n --hidden --glob '!falsify/audit_backtest_fixtures/**' --glob '!**/.git/**' \
"cmd_brooks|falsify brooks|falsify review|falsify lint|authority_ceiling|claim_scope|verdict|receipt|brooks_lint|Claiming Falsify|CLAIMING|claim-bearing" \
-S . --max-count 120 || trueRepository: shi275773124/Falsify
Length of output: 50379
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== list CLI package files =="
git ls-files falsify | sed -n '1,200p'
echo
echo "== exact command definitions/usages =="
rg -n --hidden --glob '!falsify/audit_backtest_fixtures/**' --glob '!**/.git/**' \
"def cmd_|class cli|parser.add|subparsers|falsify cli|falsify.cli|add_subparsers|handle|cmd_brooks|cmd_review|cmd_run|cmd_lint|cmd_gate|authority_ceiling|claim_scope|verdict|brooks_lint|exit_code_for_decision" \
falsify falsify/cli.py falsify/*.py -S -C 4 || true
echo
echo "== top-level docs around L0 table =="
sed -n '140,185p' docs/ROOTFIX-architecture.md | nl 2>/dev/null || cat -n docs/ROOTFIX-architecture.md | sed -n '140,185p'Repository: shi275773124/Falsify
Length of output: 50377
🏁 Script executed:
#!/bin/bash
set -euo pipefail
echo "== cmd_brooks implementation =="
rg -n "def cmd_brooks|cmd_brooks|finalize_authority|authority_ceiling|claim_scope|brooks_lint" falsify/cli.py falsify/authority_kernel.py -C 8 --max-count 200 || true
echo
echo "== cmd_review/main brooks call sites =="
rg -n "cmd_brooks|brooks|finalize_authority|authority_ceiling|claim_scope|claim-bearing" falsify/cli.py -C 6 --max-count 80 || true
echo
echo "== docs around L0 table =="
sed -n '155,175p' docs/ROOTFIX-architecture.md | nl 2>/dev/null || cat -n docs/ROOTFIX-architecture.md | sed -n '155,175p'Repository: shi275773124/Falsify
Length of output: 50376
Record the current brooks command as L0-only evidence only.
cmd_brooks emits a brooks_lint receipt plus 0/1 exit; only review/run go through the authority kernel for verdict, claim_scope, and authority_ceiling. Update the shared authority boundary docs to label standalone falsify brooks as L0 evidence, not a complete Claiming Falsify exit.
docs/ROOTFIX-architecture.md#L164-L168docs/17-skills.md#L18docs/17-skills.zh-CN.md#L18skills/falsify-brooks-lint/templates/input.md#L27
📍 Affects 4 files
docs/ROOTFIX-architecture.md#L164-L168(this comment)docs/17-skills.md#L18-L18docs/17-skills.zh-CN.md#L18-L18skills/falsify-brooks-lint/templates/input.md#L27-L27
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@docs/ROOTFIX-architecture.md` around lines 164 - 168, Update the shared
authority-boundary documentation to identify standalone falsify
brooks/cmd_brooks output as L0-only evidence: it may emit a brooks_lint receipt
and 0/1 exit, but does not provide the authority-kernel verdict, claim_scope, or
authority_ceiling supplied by review/run. Apply this clarification in
docs/ROOTFIX-architecture.md lines 164-168, docs/17-skills.md line 18,
docs/17-skills.zh-CN.md line 18, and
skills/falsify-brooks-lint/templates/input.md line 27, preserving the
distinction that review/run are the complete Claiming Falsify exit.
| # Scope-refuse text without explicit status still counts if status parsed. | ||
| if status == "ERROR" and re.search(r"scope.?refus", raw or "", re.I): | ||
| status, mode = "SCOPE_REFUSED", "scope_refused" | ||
| ran = status in ("RAN", "SCOPE_REFUSED") |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Loose "scope refus" fallback can falsely mark L0 as ran on malformed output.
re.search(r"scope.?refus", raw, re.I) matches "." as any char (including a space), so it also matches prose like "...not a scope refusal because...". Since this branch only fires when BROOKS_STATUS failed to parse (status == "ERROR"), a malformed/incomplete L0 response that merely discusses scope refusal gets reclassified to SCOPE_REFUSED → ran=True, silently satisfying l0_brooks_ran even though the model never emitted the required terminal line. This defeats the fail-closed guarantee this PR is built around.
🐛 Proposed fix: only recognize a near-miss terminal line, not free prose
- status, mode = parse_brooks_status(raw)
- findings = parse_brooks_findings(raw)
- # Scope-refuse text without explicit status still counts if status parsed.
- if status == "ERROR" and re.search(r"scope.?refus", raw or "", re.I):
- status, mode = "SCOPE_REFUSED", "scope_refused"
+ status, mode = parse_brooks_status(raw)
+ findings = parse_brooks_findings(raw)
+ # Only recognize a near-miss BROOKS_STATUS line (e.g. missing colon/case
+ # slip) — never free-form prose, which can match negated statements like
+ # "not a scope refusal" and falsely mark L0 as having run.
+ if status == "ERROR" and re.search(
+ r"(?im)^BROOKS_STATUS\W*SCOPE.?REFUSED\s*$", raw or ""
+ ):
+ status, mode = "SCOPE_REFUSED", "scope_refused"As per path instructions, "any code path that could silently produce a false PASS verdict from the audit" should be a top review focus for this file.
📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| # Scope-refuse text without explicit status still counts if status parsed. | |
| if status == "ERROR" and re.search(r"scope.?refus", raw or "", re.I): | |
| status, mode = "SCOPE_REFUSED", "scope_refused" | |
| ran = status in ("RAN", "SCOPE_REFUSED") | |
| status, mode = parse_brooks_status(raw) | |
| findings = parse_brooks_findings(raw) | |
| # Only recognize a near-miss BROOKS_STATUS line (e.g. missing colon/case | |
| # slip) — never free-form prose, which can match negated statements like | |
| # "not a scope refusal" and falsely mark L0 as having run. | |
| if status == "ERROR" and re.search( | |
| r"(?im)^BROOKS_STATUS\W*SCOPE.?REFUSED\s*$", raw or "" | |
| ): | |
| status, mode = "SCOPE_REFUSED", "scope_refused" | |
| ran = status in ("RAN", "SCOPE_REFUSED") |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@falsify/cli.py` around lines 611 - 614, Restrict the fallback in the
status-parsing flow around the `status == "ERROR"` branch to recognize only a
near-miss terminal status line indicating scope refusal, not arbitrary prose in
`raw`. Replace the loose `re.search` pattern with validation anchored to the
expected terminal-line format, preserving `SCOPE_REFUSED` and `ran=True` only
when that explicit near-miss line is present; otherwise leave malformed output
as not ran.
Source: Path instructions
| If `.brooks-lint.yaml` contains a `custom_risks` map, read `custom-risks-guide.md` | ||
| from the `_shared/` directory for loading and scanning instructions. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Correct all internal reference paths to the pack-local references/ directory.
The copied _shared/ paths do not exist in this installed skill pack, so consumers can skip mandatory review rules or custom-risk processing.
skills/falsify-brooks-lint/references/common.md#L65-L66: point custom-risk loading toreferences/custom-risks-guide.md.skills/falsify-brooks-lint/references/chris-improvements.md#L126-L135: replace_shared/common.md,_shared/chris-improvements.md, and_shared/decay-risks.mdwith the corresponding pack-localreferences/paths.
📍 Affects 2 files
skills/falsify-brooks-lint/references/common.md#L65-L66(this comment)skills/falsify-brooks-lint/references/chris-improvements.md#L126-L135
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/falsify-brooks-lint/references/common.md` around lines 65 - 66, Update
skills/falsify-brooks-lint/references/common.md lines 65-66 to load
custom-risks-guide.md from the pack-local references/ directory. In
skills/falsify-brooks-lint/references/chris-improvements.md lines 126-135,
replace each _shared/common.md, _shared/chris-improvements.md, and
_shared/decay-risks.md reference with its corresponding pack-local references/
path.
| # falsify-brooks-lint | ||
|
|
||
| ## Provenance | ||
|
|
||
| | Field | Value | | ||
| |-------|--------| | ||
| | skill_id | `falsify-brooks-lint` | | ||
| | layer | L0 Framework (Brooks-Lint) | | ||
| | upstream | `hyhmrright/brooks-lint` | | ||
| | fork_branch | `chris-improvements` | | ||
| | source_sha | `6be92af94839175665c35df77390e7baab78a303` | | ||
| | vendor_note | References copied from Hermes pack + local fork at pin time; Falsify pack is now the product source of truth | | ||
|
|
||
| Marketing alias:「框架审计」。Protocol name: **Brooks-Lint (L0)**. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Add a version note for this skill contract.
This skill defines new Evidence Gate, verdict, and receipt semantics but has no version marker. Add the current skill version (for example, v0.9.11) so consumers can identify the contract revision.
As per path instructions, skills/**/SKILL.md changes to gate definitions, verdict schema, or claim-receipt anchors must also bump the skill’s version note.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/falsify-brooks-lint/SKILL.md` around lines 1 - 14, Add a version note
to the skill contract metadata in falsify-brooks-lint, using the current skill
version (for example, v0.9.11). Place it alongside the existing Provenance
fields and ensure it identifies this revision of the Evidence Gate, verdict, and
receipt semantics.
Source: Path instructions
| ## Verdict Rules | ||
|
|
||
| - `PASS`: no Must Fix; structural surface is auditable for the current claim; Known Debt (if any) has upgrade triggers. | ||
| - `PASS_WITH_DEBT`: no Must Fix; Known Debt items have explicit upgrade triggers. | ||
| - `BLOCK`: at least one Must Fix (structural gap blocks the current decision), missing required evidence, or unparsable review. | ||
| - `SCOPE_REFUSED` (mode/status, not a product PASS): no decay surface; do not invent findings. |
There was a problem hiding this comment.
🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win
Make PASS and PASS_WITH_DEBT mutually exclusive.
Both verdicts currently allow no Must Fix items and require upgrade triggers for Known Debt, so the same result can validly produce either verdict. Define PASS as having no Known Debt and reserve PASS_WITH_DEBT for one or more Known Debt items; otherwise authority adjudication is ambiguous.
Proposed clarification
-- `PASS`: no Must Fix; structural surface is auditable for the current claim; Known Debt (if any) has upgrade triggers.
+- `PASS`: no Must Fix and no Known Debt; structural surface is auditable for the current claim.
- `PASS_WITH_DEBT`: no Must Fix; Known Debt items have explicit upgrade triggers.
+- `PASS_WITH_DEBT`: no Must Fix; one or more Known Debt items have explicit upgrade triggers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@skills/falsify-brooks-lint/SKILL.md` around lines 69 - 74, Update the Verdict
Rules defining PASS and PASS_WITH_DEBT so they are mutually exclusive: require
PASS to have no Known Debt items, while reserving PASS_WITH_DEBT for one or more
Known Debt items with explicit upgrade triggers. Preserve the existing Must Fix
and structural-audit requirements.
Claim-bearing review/run now default-run Phase-0 Brooks-Lint, emit a brooks_lint receipt block, and fail closed without l0_brooks_ran so structural audit cannot be skipped for PASS.
Summary by CodeRabbit
falsify brookscommand with JSON receipts and findings.falsify lintperforms markdown checks and is separate from Brooks-Lint.