Repository navigation
fix(hooks): strengthen codex prefix rule for actual compliance - #10
Merged
Merged
Conversation
The previous one-line advisory rule ("Always prefix shell commands with
`contextcrawler`") loaded into Codex CLI but achieved 0% compliance with
gpt-5.4-mini — the model could quote the rule verbatim yet still issued
raw shell calls, losing all token savings.
Rewrite the rule as imperative MUST guidance with concrete WRONG/RIGHT
examples, an explicit applies-to command list, and a self-check
instruction. Empirically validated against `codex exec` with a git-log
prompt: compliance jumped from 0% to 100%; `contextcrawler gain` shows
80%+ savings on the git-log filter.
No logic changes — `RTK_SLIM_CODEX` is `include_str!()`-loaded, so the
existing `assert_eq!(... RTK_SLIM_CODEX)` test in
`test_run_codex_mode_global_writes_absolute_reference_to_codex_dir`
tracks the new content automatically. All 1842 binary tests pass.
Closes #9
Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
This was referenced May 18, 2026
Merged
noogalabs
pushed a commit
to noogalabs/contextcrawler
that referenced
this pull request
Jun 4, 2026
… branding-lint extension **Version bump 0.39.0 → 0.1.7.** The upstream rebase pulled in rtk's `0.39.0` version; restoring the downstream `0.1.x` numbering line per the maintainer's call. `.release-please-manifest.json` updated to match. Last downstream tag was `v0.1.6` (2026-05-15); this is the next in the sequence. **release-please-config.json `package-name: "rtk"` → "contextcrawler".** Caught by manual audit during release prep. Same regression-family as thehoff#19 / thehoff#20 / thehoff#22: a rebrand gap the prior branding-lint (src/-scoped) didn't catch because release-please-config.json lives at repo root. Without this fix, release-please would have produced `rtk-vX.Y.Z` tags and release-PR titles. **Cargo.toml `extended-description` rebrand.** Line 77 still read "rtk filters and compresses..." — same upstream-leak family. Fixed. **Extended `tests/branding_lint.rs`** with a third test — `branding_lint_config_files_pin_canonical_package_name` — that: - Parses Cargo.toml and asserts `[package].name == "contextcrawler"` - Parses release-please-config.json and asserts `packages["."]["package-name"] == "contextcrawler"` This closes the gap that let release-please-config.json silently drift to `"rtk"` post-rebase. Any future rebase that re-introduces an upstream package-name fails `cargo test --test branding_lint` with an explicit error pointing at issues thehoff#19/thehoff#20/thehoff#22 history. **CHANGELOG.md** entry for v0.1.7 added, summarizing all PRs merged today (thehoff#10 thehoff#15 thehoff#16 thehoff#21 thehoff#24 thehoff#25 thehoff#30) plus the deferred follow-ups (thehoff#26 thehoff#27 thehoff#28 thehoff#29). Tests: 2027 bin + 3 branding-lint (1 new) + 1 harness = all pass. Verified: `contextcrawler --version` now prints `contextcrawler 0.1.7`. Refs thehoff#19 thehoff#20 thehoff#22 thehoff#29
thehoff
added a commit
that referenced
this pull request
Jun 5, 2026
ccusage 19.0 renamed the monthly JSON key from "month" to "period", hard-crashing cc-economics with: missing field `month`. Add a serde alias so both formats parse. Old-format JSON unaffected. Council triage 2026-06-02 HIGH (confirmed by agy + mmax spot-checks). Upstream ref: rtk issues rtk-ai#2178/rtk-ai#1933, PR rtk-ai#1968 pattern. Implemented via TDD in an isolated lane (red: missing-field crash reproduced; green: 7/7 ccusage tests, re-verified in main checkout). Landed with Hoff-authorised COUNCIL_OK: the council CLI review path is blocked by the git-diff filter bug (task #10) and its codex peer mutates working-tree state during review (task #11) — both now queued as the next work items. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
thehoff
added a commit
that referenced
this pull request
Jun 5, 2026
The StdinMode::Filter path read child stdin with BufRead::lines().map_while(Result::ok), which silently stops at the first invalid-UTF-8 byte — everything after it never reaches the child process. The stdout/stderr paths were already fixed with the byte-read + from_utf8_lossy pattern (for_each_line); this brings the stdin path in line. Extracts run_stdin_filter() so the lossy path is unit-testable without real io::stdin(). Invalid bytes become U+FFFD; the stream never truncates. Behavioural note: write errors after early child exit now drain stdin to EOF instead of breaking early (StdinMode:: Filter is a future-API path, not yet used in production). Council triage 2026-06-02 HIGH (flagged independently by all three voices: Codex, agy, mmax). Upstream ref: rtk PR rtk-ai#2049 pattern. TDD: red (E0425 then line-after-bad-bytes assertion), green (62/62 stream tests). Re-implemented in main checkout after the original lane's work was destroyed by the worktree-hijack bug (task #11). Landed with Hoff-authorised COUNCIL_OK (council CLI blocked by tasks #10/#11). Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
thehoff
added a commit
that referenced
this pull request
Jun 5, 2026
Task #10 — the bug that sabotaged this entire dev session, and the fork's copy of upstream rtk-ai#1918 (PR rtk-ai#1981 pattern). Problems fixed in run_diff(): - --name-only / --name-status / --raw / -z / --check / --exit-code / --quiet / -p / -U<n> / --diff-filter / --word-diff / etc. went down the compact path: a prepended `git diff --stat` run polluted output and a literal "--- Changes ---" header was injected — breaking every shell pipeline, script, and tool parsing the output (including this fork's own council CLI and the Law 2 gate). - exit-code semantics: `git diff --exit-code` exits 1 when differences exist — that is a result, not a failure. The old code treated exit!=0 as failure and DROPPED stdout (the actual diff). - passthrough output was trim()'d and println!'d — not byte-faithful. New behaviour: - is_passthrough_diff(): any machine-output flag → raw passthrough, byte-faithful stdout (print!, no trim), faithful exit code. - diff_exit_is_error(): only exit >1 is an error for git diff. - Plain `git diff` (no machine flags) keeps the compact token-saving format — that is the product; programmatic consumers now never see it. End-to-end verified against this repo's own working diff: contextcrawler git diff --name-only → exactly "src/cmds/git/git.rs" contextcrawler git diff --exit-code --stat → stat output + exit 1 Law 2: agy council review, quorum 1/1, ZERO findings (codex peer excluded from review until its repo-write access is sandboxed, task #11). Tests: 6 new (passthrough matrix, exit semantics), git module 265/265. Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
hooks/codex/rtk-awareness.md(the embeddedRTK_SLIM_CODEXtemplate) with imperative MUST wording, WRONG/RIGHT examples, an applies-to command list, and a self-check instruction.contextcrawler init -g --codex.include_str!()auto-tracks the file; existing exact-match assertion still passes.Background — see #9 for full root-cause analysis
Default template loaded into Codex but the model only complied with the prefix rule 0% of the time. After this change, compliance is 100% on the same prompt (verified by inlining the new wording in
~/.codex/AGENTS.mdand re-runningcodex execwith a git-log prompt).contextcrawler gain --historyshows 80%+ savings on the resulting git-log filter.Test plan
cargo test --bin contextcrawler— 1842 passed, 0 failedhooks::initmodule — 70 passed (coversRTK_SLIM_CODEXassertion path)git log -3 --onelinepre-fix now producescontextcrawler git log --oneline -3with the strengthened wordingCloses #9