feat(reflexes): port 5 passive rules from fs-cortex + idempotent merger#12
Open
NestorPVsf wants to merge 1 commit into
Open
feat(reflexes): port 5 passive rules from fs-cortex + idempotent merger#12NestorPVsf wants to merge 1 commit into
NestorPVsf wants to merge 1 commit into
Conversation
Ports 5 non-duplicate reflexes from fermontero/fs-cortex (MIT) into the Sinapsis passive-rules tier: - read-before-edit: verify file was Read before Edit/Write - test-after-change: reminder to run tests after code edits - git-push-safety: pre-push fetch+rebase, --force-with-lease - git-merge-verify: pre-merge CI checks + cleanup - instinct-downvote: adapted from /cx-downvote to Sinapsis /downvote Skipped 5 duplicates (env-never-commit, git-commit-quality, api-auth-check/reminder, security-headers, capture-decision). Implementation: - seeds/reflexes.json: 5 rules + MIT attribution - core/_reflex-merge.mjs: idempotent merger, user customizations win, atomic write preserves 0600 mode - install.sh / install.bat: Step 5c runs the merger after hook scripts - tests/test-reflexes.sh: 11 TDD tests (11/11 GREEN) incl. regression guard that test-after-change does NOT fire on Read/Grep Codex review fixes applied pre-commit: - P1: install.bat now mirrors install.sh reflex step - P2: merger preserves existing chmod 0600 - P2: test-after-change scoped to ^(Edit|Write) so Read/Grep dont fire Suite: 116 → 127 GREEN, 0 regressions. Credit: Fernando Montero (github.com/fermontero/fs-cortex, MIT).
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
Ports 5 non-duplicate passive rules (reflexes) from fermontero/fs-cortex (MIT) into the Sinapsis passive-rules tier. Adds an idempotent merger so fresh installs and upgrades both receive the new rules while preserving any user customizations.
Ported (5)
read-before-edit^(Edit|Write)\stest-after-change^(Edit|Write)\s.*(\.test\.|...)git-push-safetygit push|gh pr create--force-with-leasegit-merge-verifygh pr merge|git mergeinstinct-downvote/downvote|wrong instinct|.../downvoteon negative feedback (adapted from fs-cortex/cx-downvoteto Sinapsis's native/downvote)Skipped as duplicates (5)
env-never-commit,git-commit-quality,api-auth-check(→api-auth-reminder),security-headers(→security-headers-check),capture-decision(→decision-capture). Sinapsis equivalents kept as-is.Changes
seeds/reflexes.json(new): 5 rules +_credit/_licenseheader.core/_reflex-merge.mjs(new, ~100 LOC Node.js): idempotent merger, user id wins on conflict, atomictmp → renamewrite that preserves 0600 file mode (install.sh hardens_passive-rules.jsonto 0600; the merger must not relax to umask). CLI flags:--seeds-path,--index-path,--dry-run.install.sh+install.bat: new Step 5c runs the merger after hook scripts.tests/test-reflexes.sh(new): 11 TDD tests including activator-integration (rules actually fire) and a regression guard thattest-after-changedoes NOT fire on Read/Grep.Codex review fixes applied pre-commit
/codex:review --base mainflagged 3 issues, all addressed before this PR:test-after-changefired on Read/Grep because trigger only tested filename. Scoped to^(Edit|Write)\s.*. Regression test added.Test plan
bash tests/test-reflexes.sh→ 11/11 GREEN (including regression guard)seeds/reflexes.jsonbash -nsyntax oninstall.shtest-after-changedoes NOT fire on Read/Grep/codex:reviewsecond-opinion appliedIndependence
Branches from
main(45949ed). No dependency on PR #7 (dashboard), PR #8 (seeds), or PR #9 (laws). Can merge in any order.Credit
5 rules ported from fermontero/fs-cortex — MIT © 2026 Fernando Montero. Attribution preserved as
origin: seed:fermontero-fs-cortexin each rule.