Repository navigation
Add deprecate action and staleness check to BitLesson workflow - #188
LukeLIN-web wants to merge 350 commits into
Conversation
Prevent parallel tool calls across phases that can cause cascading cancellation when one call errors (e.g. Read failing cancels Bash).
Update the default effort level across source, docs, skills, and tests while keeping gpt-5.4 as the default model.
The unquoted heredoc in show_help() caused Bash to interpret raw backticks as command substitution, potentially executing unintended commands when users ran --help.
…usline
${reason^} requires Bash 4+ but macOS ships Bash 3.2, causing
bad substitution errors when rendering terminal RLCR states.
* Migrate bitlesson and config infrastructure to staging branch Cherry-pick bitlesson workflow, config-loader, model-router, and config-driven defaults from feat/rlcr-loop-improvements (e3af54c) onto origin/dev (f833ff0) via staging worktree. 29 files: 10 A-class (whole-file bitlesson), 7 B-class (config infra), 2 D-class (new test files), 10 C-class (mixed hunks extracted). Excludes non-bitlesson/config changes (codex-worker, continue-rlcr-loop, ask-codex routing, gen-plan template, etc.). All 8 test suites pass (88 tests, 0 failures). Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Scope setup-rlcr-loop changes to bitlesson and reviewer config * Clean bitlesson branch: revert worker/provider routing, keep config hierarchy and bitlesson Reverts all multi-worker model config keys (coding_worker_model, analyzing_worker_model, loop_reviewer_model etc.), DELEGATION_ENFORCEMENT, multi-provider routing in the stop hook, and cross-vendor review protocol prompts to origin/dev state. Keeps only: - 4-level config hierarchy (config/default_config.json + config-loader.sh merge logic) - bitlesson_model config key (sole new config option) - Bitlesson implementation wiring (init, validate-delta, select scripts, prompt blocks, hook/setup plumbing for bitlesson_required/bitlesson_file/bitlesson_allow_empty_none) Files changed: - config/default_config.json: remove worker/reviewer keys, keep bitlesson_model + 3 others - scripts/lib/config-loader.sh: remove legacy migration function - hooks/lib/loop-common.sh: restore hardcoded DEFAULT_CODEX_MODEL/EFFORT, remove worker vars - Stop hook: remove multi-provider routing, restore codex-only path, fix task tag routing - scripts/setup-rlcr-loop.sh: restore from origin/dev, re-apply all bitlesson patches - commands/start-rlcr-loop.md: revert worker routing refs, keep BitLesson Workflow section - prompt-template/claude/agent-teams-core.md: remove cross-vendor mandate + worker refs, keep BitLesson Discipline item - prompt-template/claude/next-round-prompt.md: remove cross-vendor section, add bitlesson selection steps with BITLESSON_FILE template variable - prompt-template/claude/review-phase-prompt.md: remove cross-vendor step, keep bitlesson step, restore step numbering (1-5) - tests: remove 3 deleted test files, replace worker model assertions with valid key checks - .gitignore: remove misleading /bitlesson.md root entry All 1415 tests pass. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix gitignore: restore /bitlesson.md to keep root-level file out of version control The root bitlesson.md was previously gitignored. Removing the entry in the prior commit caused it to appear as untracked. Re-add the entry with a clearer comment. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Fix gitignore and test suite per Codex review - .gitignore: remove /bitlesson.md entry (plan AC-7 fix); keep /.claude/settings.json and .humanize/ entries which are valid bitlesson branch additions - tests/run-all-tests.sh: remove 3 non-existent suites (test-continue-rlcr-loop.sh, test-ask-codex-routing.sh, test-codex-worker-routing.sh) that were silently skipped All 1415 tests pass with no SKIP entries. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * Add dedicated reviewer model configuration (loop_reviewer_model/effort) Wire loop_reviewer_model and loop_reviewer_effort end-to-end through the config hierarchy, setup script, state file, and stop hook: - Add keys to config/default_config.json (defaults: gpt-5.4, high) - Add field constants and config loading to loop-common.sh - Extend parse_state_file() for new reviewer fields - Write reviewer config to state.md in setup-rlcr-loop.sh with validation - Update stop hook fallback chain: reviewer -> codex -> defaults - Fix CODEX_REVIEW_EFFORT inconsistent fallback (was hardcoded "high") - Add 43 tests covering all acceptance criteria - Update codex-invocation-roles.md and usage.md documentation - Bump version to 1.15.1 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix reviewer config fallback chain, quote parsing, and test coverage Address three Codex review findings: P1: Stop hook final fallback now uses DEFAULT_LOOP_REVIEWER_* instead of DEFAULT_CODEX_*, ensuring project config.json reviewer overrides are honored even with legacy/bare state files. P2: State parser now strips surrounding quotes from reviewer fields (matching existing string field patterns), preventing quoted YAML like loop_reviewer_model: "gpt-5.2" from breaking validation. P2: Tests corrected to assert DEFAULT_LOOP_REVIEWER_* fallback. Added: - Quoted YAML frontmatter test case - Config override + bare state integration test - Real setup-rlcr-loop.sh execution test in temp git repo - Simplified exec/review to shared resolution (code-simplifier) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix setup test isolation and add stop-hook effort enum validation - Set CLAUDE_PROJECT_DIR to temp repo in execution-based setup test to prevent detecting the live RLCR session - Make STATE_FILE find lookup non-fatal under set -e - Tighten stop-hook effort validation from YAML-safe regex to enum check (xhigh|high|medium|low), matching setup script behavior - Add regression test verifying enum pattern in stop hook source Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Add behavioral stop-hook regression test and assert setup exit status - Capture setup-rlcr-loop.sh exit code and assert it is zero before checking state.md contents (prevents false passes on partial setup) - Replace source-grep-only stop-hook test with behavioral regression: creates temp active loop with invalid effort "superhigh", runs the actual stop hook with a stubbed codex, asserts error message output, codex not invoked, and state renamed to unexpected-state.md - 54 tests passing Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Include templates/ and config/ in installed skill runtime bundle The installer only copied scripts, hooks, and prompt-template to the runtime bundle. This caused two failures in installed skill runtimes: - setup-rlcr-loop.sh could not find ../templates/bitlesson.md - config-loader.sh could not find config/default_config.json Add both directories to the install_runtime_bundle copy loop. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Fix BitLesson label, --codex-model reviewer override, and skip-impl enforcement - Fix round-0 summary template: "Lesson IDs applied:" -> "Lesson ID(s):" to match bitlesson-validate-delta.sh accepted labels - Only write loop_reviewer_model/effort to state.md when user/project config explicitly sets them; otherwise the stop-hook fallback chain reaches codex_model/effort (set by --codex-model), restoring the per-run model override behavior - Add LOOP_REVIEWER_CONFIG_EXPLICIT detection in loop-common.sh by checking user and project config files for reviewer keys via jq - Disable BitLesson delta enforcement in --skip-impl mode by writing bitlesson_required: false to state.md (skip-impl prompts do not include BitLesson-aware templates) - Extract REVIEWER_MODEL_DISPLAY/REVIEWER_EFFORT_DISPLAY for cleaner startup output Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Finalize: extract assert_eq helper in reviewer config tests Replace ~30 repetitive if/then/else pass/fail blocks with a reusable assert_eq helper function, reducing approximately 90 lines of boilerplate while preserving identical test behavior and output. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Unify codex model config: remove loop_reviewer_model/effort, make codex_model/effort config-backed Eliminates the reviewer-specific configuration surface (loop_reviewer_model, loop_reviewer_effort) introduced in bd73062/df6371c/eaf66d0 and unifies all Codex model configuration under codex_model/codex_effort. Key changes: - default_config.json: replace reviewer keys with codex_model/codex_effort - loop-common.sh: load DEFAULT_CODEX_MODEL/EFFORT from merged config hierarchy with precedence: caller preset > config value > hardcoded fallback (gpt-5.4/high) - stop-hook: simplify 3-tier fallback to 2-tier (STATE_CODEX_* -> DEFAULT_CODEX_*) - setup-rlcr-loop.sh: remove all reviewer-specific validation and state fields - Replace test-reviewer-config.sh with test-unified-codex-config.sh (44 tests) - docs/usage.md: document unified codex config with migration note Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Inline temporary variables in setup execution test assertions * Fix PR loop config masking: let codex_model flow from config hierarchy PR loop scripts previously pre-set DEFAULT_CODEX_MODEL before sourcing loop-common.sh, which masked config-backed codex_model values. Now only DEFAULT_CODEX_EFFORT="medium" is pre-set (intentional PR-specific default), allowing codex_model to resolve from the 4-layer config hierarchy. Also updates help text in ask-codex.sh, setup-pr-loop.sh, and docs/usage.md to describe config-backed defaults. Adds 13 new tests (57 total) covering PR loop and ask-codex config behavior. * Complete AC-6 and AC-7: add runtime behavioral tests and fix RLCR docs AC-7: Updated docs/usage.md RLCR command reference to describe config-backed defaults instead of hardcoded gpt-5.4:high, matching the actual help text. AC-6: Extended test suite with 7 new runtime behavioral tests (64 total): - PR loop --help shows config-backed default with project config set - PR loop --codex-model override correctly parses and overrides config - ask-codex with config reports config-backed model/effort in stderr - ask-codex with --codex-model override reports override values in stderr All tests use mock codex binary and proper test isolation per BL-20260311-test-env-isolation. * Replace PR loop --codex-model simulation with end-to-end execution test Replaces the parser simulation test with an actual setup-pr-loop.sh execution using mock gh and codex binaries. The mock gh handles all API calls needed for PR loop initialization (auth, repo view, PR view, comments, reviews). The test runs setup-pr-loop.sh --claude --codex-model override-model:xhigh and asserts the generated state.md contains the override values, not config defaults. Test suite now passes 66/66. * Fix plan drift protection, bitlesson override, model default, and tag routing - Replace plan.md symlink with copy so drift detection works correctly - Only auto-enable bitlesson when state is unset, not when explicitly false - Change bitlesson_model default from haiku to gpt-5.4 for codex-only installs - Default untagged plan tasks to coding instead of blocking execution * Exclude .humanize/ untracked files from stop-hook dirty check, ship agents in skill installs - Filter .humanize/ untracked entries from git status blocking decision so bitlesson.md created during setup does not trigger "Git Not Clean" in target repos without .humanize/ in .gitignore - Add agents/ to install-skill.sh runtime bundle so bitlesson-selector agent definition is available in skill-mode installs * Tighten bash validator, .humanize filter, and statusline session_id matching - Restrict hook-script blocking to execution commands only (bash/sh/source) so read-only commands like cat/grep are not blocked - Narrow .humanize untracked filter from \.humanize to \.humanize/ so unrelated files like .humanize-notes.md still trigger dirty-tree check - Require non-empty session_id in statusline prescan to match find_active_loop() behavior and avoid showing Off for new loops * Revert bitlesson_model default to haiku The default was changed to gpt-5.4 in a previous round, but this contradicts documentation and test expectations. Reverting to haiku to maintain consistency with existing behavior. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * Block absolute-path execution of hooks and surface config warnings - Extend bash validator regex to catch /abs/path/script.sh execution patterns alongside bash/sh/source invocations - Remove 2>/dev/null from load_merged_config in loop-common.sh so malformed config warnings are visible to all callers * Resolve project root via git toplevel in loop-common and bitlesson-select Use git rev-parse --show-toplevel as fallback when CLAUDE_PROJECT_DIR is unset, so config loading finds .humanize/config.json even when scripts are sourced or run from a subdirectory. * Enforce bitlesson on round 0, block relative-path hook execution, fix review effort - Remove round 0 exemption from bitlesson entry enforcement so --require-bitlesson-entry-for-none applies from the first round - Extend bash validator regex to catch relative paths and bare script names (hooks/script.sh, script.sh via PATH) in addition to interpreters and absolute paths - Hardcode codex review effort to high so code review phase is never weakened by lower exec effort settings * Fall back to codex when claude missing, defer plan file creation, strict effort validation - bitlesson-select.sh: gracefully fall back to codex provider when the configured provider binary (e.g. claude for haiku) is unavailable - validate-gen-plan-io.sh: remove file creation to keep validation side-effect-free; gen-plan.md now creates the file after relevance check - setup-rlcr-loop.sh: validate effort against xhigh|high|medium|low enum at setup time, consistent with stop-hook validation - test-bitlesson-select-routing.sh: updated test 7 to verify fallback * docs: explain config and bitlesson systems * docs: move config and bitlesson under documentation * docs: link config and bitlesson from documentation * docs: split bitlesson workflow into dedicated guide * docs: trim bitlesson note from usage guide * test: align codex effort validation expectation * test: preserve full logs for failed suites * fix: address review findings from PR PolyArch#40 - Fix unreachable bitlesson auto-activation by checking RAW_BITLESSON_REQUIRED emptiness instead of BITLESSON_REQUIRED - Add path traversal validation to bitlesson-init.sh (reject absolute paths and .. components) - Broaden detect_provider to match o[0-9]* prefix for future OpenAI model series (o4-mini, etc.) - Align setup-rlcr-loop.sh git filter with stop hook (filter all .humanize/ untracked entries, not just specific files) - Resolve large-file check paths relative to PROJECT_ROOT so the MAX_LINES guard works when hook runs outside repo root - Add source guard to config-loader.sh (consistent with model-router.sh) - Remove unused _config_loader_extract_string containing eval - Revert version to 1.15.0 * test: register unified codex config suite in test runner * test: fix setup execution test to detect default branch name The test hardcoded --base-branch master, but git init.defaultBranch may be configured to main. Use git rev-parse to detect the actual default branch in the test repo. * Revert "test: fix setup execution test to detect default branch name" This reverts commit 1f70861. * test: ensure master branch exists in setup execution test The test passes --base-branch master but init_test_git_repo creates the default branch from git config (often main). Create an explicit master branch so the test environment matches the expected input. --------- Co-authored-by: zenus <q18003877513@gmail.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Sihao Liu <sihao@cs.ucla.edu>
Move user-supplied and external content from printf format strings to %s arguments to prevent % characters from being interpreted as format specifiers. Affected monitors: RLCR, PR loop, and skill. ANSI escape code variables (cyan, reset, etc.) remain in the format string so printf can interpret their \033 sequences correctly.
Both total_acs and completed_acs now extract unique AC identifiers (grep -oE + sort -u) instead of counting matching lines. This fixes two issues: completed_acs missing ACs beyond the first in comma- separated rows, and methodology mismatch between total/completed counts that could cause completed > total display.
Add a pre-exit analysis phase that spawns an Opus agent to review development records from a methodology perspective. The agent produces a sanitized report (no project-specific info) and optionally helps the user file a GitHub issue with improvement suggestions. New --privacy flag disables the feature; legacy loops default to privacy=true (opt-in only for new loops). The phase integrates into all three non-manual exit paths (complete, stop, maxiter) using the established Finalize Phase pattern with state file renaming and a completion artifact gate.
Address Codex review findings: - Require methodology-analysis-report.md to exist before allowing completion (prevents silent no-op when Opus agent does not run) - Fail closed when .methodology-exit-reason marker is missing or invalid instead of defaulting to "complete" (prevents misreporting stop/maxiter loops as successful)
…y analysis The Opus analysis agent needs to read all round-*-summary.md and round-*-review-result.md files, but the read validator was blocking access to summaries from non-current rounds. Bypass the round number check when methodology-analysis-state.md is the active state file, while still requiring files to be within the active loop directory.
…d allowlist Address Codex review findings: - Use realpath to canonicalize paths before prefix check, preventing directory traversal attacks (e.g., LOOP_DIR/../sensitive-file) - Restrict allowed reads to an explicit allowlist of files the analysis agent actually needs: round summaries, review results, and its own artifacts. This prevents exposing plan.md, prompt files, and other project-specific loop metadata that would undercut sanitization.
* Add Plan Understanding Quiz pre-flight check for start-rlcr-loop Add an advisory quiz that runs before the RLCR loop starts, verifying the user understands the technical implementation details of their plan. An opus-model agent analyzes the plan and generates 2 multiple-choice questions. If the user answers incorrectly, the system explains the plan and offers to stop or proceed. New flags: - --yolo: skip quiz and enable --claude-answer-codex (full automation) - --skip-quiz: skip quiz only without other behavioral changes gen-plan auto-start now passes --skip-quiz since the user already demonstrated understanding through the convergence discussion. * Add No Wishful Coding philosophy to README and usage guide Explain the motivation behind the Plan Understanding Quiz: users must understand their own plan before running an RLCR loop. Document the quiz workflow, skip options, and the core principle that the human must remain the architect. * Shorten README philosophy section, link to usage guide for details * Fix SIGPIPE flaky test in test-skill-monitor.sh Replace echo-pipe-grep pattern with here-strings to avoid broken pipe errors under pipefail when grep -q exits early. * Fix SIGPIPE in test-templates-comprehensive.sh Same echo-pipe-grep pattern replaced with here-string to avoid broken pipe under pipefail.
Add methodology analysis restrictions to all four validators: - Read validator: restrict loop dir reads to allowlisted artifacts only - Write validator: block all writes except methodology report/done marker - Edit validator: block all edits except methodology report/done marker - Bash validator: block git write commands and in-place file editing tools This prevents source code modifications after Codex has signed off and prevents project-specific information from leaking into the analysis report.
All four validators now try unfiltered loop search when session-filtered search returns empty, so spawned agents (with different session_id) are also subject to methodology analysis restrictions. Bash validator now blocks: touch, mv, cp, rm, dd, truncate, chmod, chown, output redirection to non-/dev/ paths, and all git write commands.
Handle BSD/macOS where realpath fails for non-existent files by resolving the parent directory and appending the basename. This allows the initial Write to methodology-analysis-report.md to succeed. Narrow the bash gh allowlist from all gh commands to only gh issue subcommands, preventing workspace mutations via gh pr checkout, gh repo clone, or mutating gh api calls.
Read validator now blocks reads of files within the project root (not just loop dir) during methodology analysis, while still allowing system files outside the project (CLAUDE.md, configs). This prevents the analysis agent from accessing source code that could leak into the report. Bash validator now blocks common interpreter commands (python, ruby, node, perl, php) during methodology analysis as defense-in-depth against file write bypasses.
…ology analysis Add find_methodology_analysis_loop() that scans all loop directories for methodology-analysis-state.md instead of using the unfiltered find_active_loop fallback which only returns the newest active loop. This prevents spawned agents from binding to a wrong concurrent session during methodology analysis. Block shell script entry points (bash/sh/zsh, build tools, source/dot commands, direct script execution) in the bash validator during methodology analysis to prevent bypassing file modification restrictions via wrapper binaries.
… tests to verify exact invocation artifact and exit code Adds run_ask_codex_capturing_dir() which captures stderr from run_ask_codex, extracts the unique id from the "ask-codex: cache=.../skill-<id>" line, and resolves RUN_SKILL_DIR=$MOCK_PROJECT/.humanize/skill/<id>. Also records RUN_EXIT_CODE for the invocation. Updates the four argument-parsing assertions (--codex-model MODEL:EFFORT, --codex-model MODEL no effort, -- separator, --codex-timeout) to use the helper and gate on RUN_EXIT_CODE -eq 0 before inspecting input.md. This closes the verification gap where input.md could be read from a failed invocation since ask-codex.sh writes it before calling Codex.
… regression run_ask_codex_capturing_dir() now uses the "response saved to" stderr line as the primary source for RUN_SKILL_DIR (layout-agnostic). When that line is absent it falls back to explicit case matching on basename(cache_path): skill-* -> normal layout, cache -> fallback layout (non-writable XDG_CACHE_HOME), otherwise RUN_SKILL_DIR="". Adds RUN_XDG_CACHE_HOME control variable and a regression test that sets XDG_CACHE_HOME to a non-writable directory, confirming the helper resolves the correct skill dir in the fallback branch. 35/35 pass.
[P2] commands/gen-idea.md: add Bash(rm:*) to allowed-tools so the cleanup path (delete OUTPUT_FILE + DIRECTIONS_JSON_FILE on companion JSON validation failure) can execute. Update Hard Constraint prose to document that rm is permitted solely for this cleanup. [P2] scripts/validate-gen-idea-io.sh: remove the */* (slash-contains) branch from looks_like_path. Only .md-suffixed whitespace-free inputs are treated as file paths; slashes alone are unreliable indicators and misclassify valid inline ideas like "undo/redo" or "CI/CD" as missing file paths. Update comment to reflect the narrowed heuristic. tests/test-validate-gen-idea-io.sh: add NT-6 (undo/redo) and NT-7 (CI/CD) regression tests. Suite: 9/9 pass. Full suite: 1922/1922.
[P1] Add skills/humanize-rlcr/SKILL-kimi.md with explicit rlcr-stop-gate.sh invocation. Add overwrite_kimi_rlcr_skill() to install-skill.sh; called from install_kimi_target after sync_target. Kimi installs no longer receive the native-stop-hook SKILL.md. [P2] install_codex_target: pass hardcoded "codex" to install_codex_user_config instead of $TARGET, so --target both correctly writes provider_mode: codex-only. tests/test-codex-hook-install.sh: 4 new regression tests (Kimi gate present, Kimi native-stop-hook text absent, both provider_mode). Suite: 22/22. Full suite: 1926/1926.
When KIMI_SKILLS_DIR and CODEX_SKILLS_DIR resolve to the same path (e.g. via --skills-dir), install_codex_target would overwrite the Kimi-specific humanize-rlcr/SKILL.md with the Codex version, silently producing a Codex-only install. Add a guard after LEGACY_SKILLS_DIR resolution that calls die() when TARGET==both and both dirs resolve to the same realpath. tests/test-codex-hook-install.sh: add 2 regression tests confirming --target both with shared dir exits non-zero with a conflict message. Suite: 24/24. Full suite: 1928/1928.
…name [P1] setup-rlcr-loop.sh: change PRIVACY_MODE default from "false" to "true". Methodology analysis is now disabled unless --no-privacy is passed. Add --no-privacy flag (sets PRIVACY_MODE="false"). Keep --privacy as a no-op for backward compatibility. This prevents Codex native installs from being parked in methodology-analysis-state.md when the required Agent/AskUserQuestion tools are unavailable. [P1] methodology-analysis.sh: remove the mv+rm from complete_methodology_analysis(). The function now validates only and returns 0; it no longer renames the state file. This keeps methodology-analysis-state.md active until the caller confirms the git-clean gate passes. loop-codex-stop-hook.sh: after the post-analysis git-clean check passes, read .methodology-exit-reason and do the mv+rm there, so the loop cannot exit without satisfying the cleanliness requirement.
…ject no-disable codex installs [P1] worker-prompt.md: remove `git checkout "<BASE_BRANCH>"` from the worker Setup section. Git forbids two worktrees from checking out the same branch simultaneously; the coordinator already holds that checkout. Workers are created in detached HEAD state at BASE_COMMIT, so HEAD is already at the correct commit. Replace the checkout line with an explanatory comment. Update the matching constraint prose in commands/explore-idea.md. [P2] install-codex-hooks.sh: add --disable presence check to require_codex_hooks_support(). If codex_hooks is present but `codex --help` lacks --disable, the installer now dies with a clear upgrade message. The stop hook's recursive-invocation guard (lines 1176-1187) requires --disable codex_hooks; installing on a build that lacks it would leave the guard silently bypassed. tests/test-codex-hook-install.sh: add --help handler to main fake codex (outputs --disable). Add two new tests: installer rejects codex_hooks-present + --disable-absent builds, and error message mentions --disable.
Change resolution order: try git rev-parse --show-toplevel first (correct in worktrees), then fall back to CLAUDE_PROJECT_DIR (for non-git contexts). This ensures workers in explore-idea worktrees resolve to their actual checkout, not the stale coordinator session root. Adds documentation of the rationale and updates Phase 4 Worker Dispatch in explore-idea.md to specify batching behavior that respects EFFECTIVE_CONCURRENCY, which now works correctly with the worktree-safe root resolution.
…rference Several hook system robustness tests were accidentally picking up the real active loop from the project directory instead of using isolated test directories. Add explicit cd into TEST_DIR before running hooks to ensure git rev-parse fails and the resolver falls back to CLAUDE_PROJECT_DIR. This ensures tests remain isolated regardless of whether an active loop exists in the project.
…files Extract large monolithic hook into focused library modules: - loop-codex-gates.sh: Loop state validation and gate checks - loop-codex-handlers.sh: Codex execution and result handling - loop-codex-review.sh: Review prompt generation - loop-codex-stop-hook-helpers.sh: Utility functions - loop-codex-validation-checks.sh: Input/output validation Main hook now imports and orchestrates these modules, reducing its size and improving maintainability while preserving all functionality.
…k refactoring Add exit-handlers, quick-checks-runner, and state-parser library modules to complete the modularization of loop-codex-stop-hook functionality.
Fail explore validation without resolvable Git anchors, tighten directions.json schema validation, make final-idea productization the default follow-up, and harden shell probes plus worker prompt constraints.
Avoid Bash 4-only mapfile in the style compliance test and let the viz parser handle simple frontmatter when PyYAML is absent, so the rebased full suite can run in the local macOS environment.
Fix Codex review base prompt compatibility
# Conflicts: # hooks/loop-codex-stop-hook.sh # tests/test-disable-nested-codex-hooks.sh # tests/test-finalize-phase.sh
Use here-strings instead of echo | grep pipelines so that grep -q finishing early cannot raise SIGPIPE on echo under set -o pipefail. Mirrors the same fix already applied to test-templates-comprehensive.sh.
feat(explore-idea): add explore-idea command + gen-idea directions.json companion (v1.17.0)
BitLesson's knowledge base was effectively append-only: the round stop
gate validates only the Delta format, with no way to retire a superseded
lesson and no check that an existing lesson's cited paths still resolve.
After a refactor, entries silently rot, and a stale lesson handed to an
implementer is worse than none.
deprecate:
- bitlesson-validate-delta.sh accepts `Action: deprecate`, routed through
the existing concrete-ID + Notes checks so it references a real entry.
- Deprecation is a tombstone, not a delete: mark the entry
`Status: deprecated` and keep it for history; bitlesson-select.sh never
selects a deprecated entry.
- Contract text updated across docs/bitlesson.md, commands/start-rlcr-loop.md,
templates/bitlesson.md, setup-rlcr-loop.sh, loop-codex-stop-hook.sh, and
the bitlesson-delta-{invalid,missing} block templates.
staleness:
- New scripts/bitlesson-staleness.sh reports entries whose cited file
references no longer resolve under the project root. Advisory by default,
--strict exits non-zero, deprecated entries skipped.
- Detection is extension-anchored for precision: it ignores prose slashes
and ratios (GO/NO-GO, 248/275), fenced template blocks, and ellipses.
tests:
- +4 validator cases (deprecate) and a new staleness suite (8 cases), both
registered in run-all-tests.sh. Full suite: 2265 pass, 0 fail.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
Behavior unchanged (same flags on the real KB, all 8 tests green); ~254 -> 132 lines. - Drop guards now subsumed by extension-anchoring + the path charset (glob/special-char chain, URL `//`, ratio, leading-dash checks). - Replace the per-token `find` + cache with a single repo scan: collect file basenames once, resolve bare filenames via membership test. - Replace the report state machine with an ordered map printed at the end. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@codex review this pr thoroughly |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22df60ce91
ℹ️ 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".
| BITLESSON_ACTION=$(echo "$BITLESSON_ACTION_CANDIDATES" | awk 'NF{print; exit}') | ||
|
|
||
| if [[ "$BITLESSON_ACTION_COUNT" -ne 1 ]] || [[ "$BITLESSON_ACTION" != "none" && "$BITLESSON_ACTION" != "add" && "$BITLESSON_ACTION" != "update" ]]; then | ||
| if [[ "$BITLESSON_ACTION_COUNT" -ne 1 ]] || [[ "$BITLESSON_ACTION" != "none" && "$BITLESSON_ACTION" != "add" && "$BITLESSON_ACTION" != "update" && "$BITLESSON_ACTION" != "deprecate" ]]; then |
There was a problem hiding this comment.
Require deprecate to tombstone the lesson
When a round reports Action: deprecate, this path now accepts the action but then only reuses the generic ID/Notes/existence checks; it never verifies that the referenced entry was actually marked with Status: deprecated. A summary can therefore pass while the lesson remains active and still eligible for bitlesson-select.sh, which defeats the new tombstone workflow in any round where the author forgets to edit the entry itself.
Useful? React with 👍 / 👎.
| [[ "$b" == "1" ]] && DEPRECATED=$((DEPRECATED + 1)) | ||
| else # CAND: a=type, b=key, c=token | ||
| if [[ "$a" == "S" ]]; then | ||
| [[ -e "$PROJECT_ROOT/$c" || -e "$c" ]] && continue |
There was a problem hiding this comment.
Resolve staleness paths only inside the project root
When this scanner is invoked from outside the project, the || -e "$c" fallback lets a slash-bearing reference pass merely because the same relative path exists in the caller's current directory, even though it is missing under --project-root. That makes --strict produce false negatives for stale lessons in common scripted/absolute-path invocations; the check should be rooted consistently at PROJECT_ROOT rather than also consulting the process cwd.
Useful? React with 👍 / 👎.
22df60c to
7cf6c24
Compare
BitLesson's knowledge base was effectively append-only: the round stop gate validates only the Delta format, with no way to retire a superseded lesson and no check that an existing lesson's cited paths still resolve. After a refactor, entries silently rot, and a stale lesson handed to an implementer is worse than none.
deprecate:
Action: deprecate, routed through the existing concrete-ID + Notes checks so it references a real entry.Status: deprecatedand keep it for history; bitlesson-select.sh never selects a deprecated entry.staleness:
tests: