Skip to content

tools(hygiene): TS port of check-no-op-cadence-pattern.sh (Aaron 2026-05-03 'not ts file?')#1366

Merged
AceHack merged 2 commits intomainfrom
tools/hygiene-no-op-cadence-pattern-ts-port
May 3, 2026
Merged

tools(hygiene): TS port of check-no-op-cadence-pattern.sh (Aaron 2026-05-03 'not ts file?')#1366
AceHack merged 2 commits intomainfrom
tools/hygiene-no-op-cadence-pattern-ts-port

Conversation

@AceHack
Copy link
Copy Markdown
Member

@AceHack AceHack commented May 3, 2026

Per DST-justifies-TS-quality-over-bash + B-0156 TS standardization. Aaron 2026-05-03 flagged the bash-only state as a gap. TS port preserves all behavior; verified parity with bash version (both produce identical output on current main state). Bash version retained for cross-shell compatibility on environments without bun.

…-05-03 'not ts file?')

Per DST-justifies-TS-quality-over-bash discipline (CLAUDE.md) +
B-0156 TypeScript standardization for non-install scripts. The
.sh version was the only existing implementation; Aaron flagged
the gap.

TS port preserves all behavior:
- WINDOW_SIZE=7 / THRESHOLD=5 / GAP_THRESHOLD=15 env-var config
- today + yesterday UTC shard collection
- HHMMZ.md / HHMMZ-<hex>.md / HHMMSSZ-<hex>.md filename patterns
- primary-key + disambiguator sort
- minimal-observation heuristic: body < 600 chars OR
  observation-class regex
- shard-density gap check
- exit 0 always (informational only)

Verified parity: both scripts produce identical "1 match
(threshold 5); 5 minutes old (gap-threshold 15)" output on
current main state.

Bash version retained for cross-shell compatibility on
environments without bun. Both kept in sync going forward.
Copilot AI review requested due to automatic review settings May 3, 2026 09:23
@AceHack AceHack enabled auto-merge (squash) May 3, 2026 09:23
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 7fb32ae877

ℹ️ 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".

Comment thread tools/hygiene/check-no-op-cadence-pattern.ts
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a TypeScript/Bun implementation of the existing hygiene check that detects “no-op cadence” and shard-density gaps by scanning recent tick-history shard files under docs/hygiene-history/ticks/.

Changes:

  • Introduces tools/hygiene/check-no-op-cadence-pattern.ts as a TS port of the existing bash script.
  • Implements shard collection/sorting for today+yesterday (UTC) and applies the minimal-observation + shard-gap heuristics.
  • Emits warnings to stderr while preserving the “informational only (exit 0)” contract.

Comment thread tools/hygiene/check-no-op-cadence-pattern.ts
Comment thread tools/hygiene/check-no-op-cadence-pattern.ts Outdated
Comment thread tools/hygiene/check-no-op-cadence-pattern.ts Outdated
Comment thread tools/hygiene/check-no-op-cadence-pattern.ts
Comment thread tools/hygiene/check-no-op-cadence-pattern.ts Outdated
…REPO_ROOT + strict env validation + try-catch readdir + regex parity

6 substantive review findings absorbed:

P0 (line 46): REPO_ROOT walked upward until "/" → infinite loop on
Windows drive roots. Replaced with `git rev-parse --show-toplevel`
fallback to cwd, per repo-scripting.md convention.

P1 (line 5): Repo scripting convention requires `main` function +
named exports + `if (import.meta.main) { process.exit(main(...)) }`
guard. Restructured: collectShards / parsePositiveInt / runCheck /
isMinimalObservation now exported; main() function + entrypoint
guard at bottom.

P1 (line 108): readdirSync without try/catch threw on
exists-but-unreadable directories. Wrapped in try/catch returning
empty array.

P1 (line 154): `\s` differs between JS regex and grep -E semantics.
Replaced with explicit `[ \t]` for parity.

P1 (line 196): Warning message text didn't match bash version.
Restored "just-landed substrate" wording + matched bash gap-warning
text exactly.

P2 (line 50): parseInt accepted "7abc" → 7 (loose validation).
Added strict `^[0-9]+$` full-string check before parseInt.

Verified parity: both scripts produce identical output on current
main state ("1 match (threshold 5); 16 minutes old (gap-threshold
15)" — gap warning fires from both).
AceHack added a commit that referenced this pull request May 3, 2026
@AceHack AceHack merged commit 698de09 into main May 3, 2026
24 of 25 checks passed
@AceHack AceHack deleted the tools/hygiene-no-op-cadence-pattern-ts-port branch May 3, 2026 09:38
AceHack added a commit that referenced this pull request May 3, 2026
…t tick-start (Aaron 'important to survival') (#1367)

* docs(AUTONOMOUS-LOOP): land Check 0a no-op-cadence mechanical-check at tick-start (Aaron 2026-05-03 'important to survival')

Aaron 2026-05-03: "i'd remember this now if i were you, sounds
importatant to survival" — pointing at the tick-start mechanical-
check discipline (bun tools/hygiene/check-no-op-cadence-pattern.ts).

Existing tool catches the failure mode at decision-time:
- ≥5 minimal-observation in last 7 shards OR
- Most recent shard >15 min old

Without it, agent drift into ~20-tick-acknowledgment-only patterns
goes unnoticed until human maintainer surfaces manually (per the
corrective lineage at 0913Z + 0918Z + #1366 shards earlier today).

Step 0 split: 0a no-op-cadence mechanical check; 0b cadence-tracker
grep (existing). Both run at tick-open before priority-ladder.

Future-Otto reads docs/AUTONOMOUS-LOOP.md at session-start via
CLAUDE.md tick-must-never-stop bullet's pointer; the discipline is
now discoverable as carved-sentence-plus-index Layer-3 substrate.

* fix(#1367 carved-sentence compression per Aaron 2026-05-03): Step 0 from ~50 lines verbose prose → ~22 lines dense operational form

* fix(#1367 review): clarify lineage prose — '1366 shard' ambiguity → explicit 'tick shards X + Y, plus PR #1366'
AceHack added a commit that referenced this pull request May 3, 2026
… — closing cadence gap + summarizing #1366 + #1367 + AUTONOMOUS-LOOP.md Step 0 landing (#1368)
AceHack added a commit that referenced this pull request May 3, 2026
…ath; Aaron 2026-05-03 'fully converted' directive) (#1371)

Aaron 2026-05-03 directive: "we should clean up oh sh and any oh sh
wehre we have the ts i thought we were fully converted" + carve-out
"we need install graph sh files don't forget to go to the devloper
where they live but after install it's ts was have a common base".

This PR removes 13 zero-ref .sh files in tools/hygiene/ where .ts
equivalents exist. All are post-install (run by tick discipline,
hygiene checks, etc. — bun is available). Install-graph .sh files
under tools/setup/ stay (pre-bun chicken-and-egg).

Removed (13):
- append-tick-history-row.sh
- audit-agencysignature-main-tip.sh
- audit-cross-platform-parity.sh
- audit-git-hotspots.sh
- audit-machine-specific-content.sh
- audit-md032-plus-linestart.sh
- audit-missing-prevention-layers.sh
- audit-post-setup-script-stack.sh
- audit-tick-history-bounded-growth.sh
- capture-tick-snapshot.sh
- check-no-op-cadence-pattern.sh (just-merged sibling per #1366)
- counterweight-audit.sh
- validate-agencysignature-pr-body.sh

Deferred (4 referenced .sh):
- audit-memory-index-duplicates.sh (4 refs)
- audit-memory-references.sh (4 refs)
- check-archive-header-section33.sh (1 ref)
- check-no-conflict-markers.sh (1 ref)
- check-tick-history-order.sh (1 ref)
These need reference updates first before the .sh can safely be removed.

Also: AUTONOMOUS-LOOP.md Step 0a — removed "Bash sibling .sh" carve-out
text since the no-op-cadence-pattern.sh is now removed; Step 0a is
.ts-only.

Reference: any future scripts/CI/hooks that need to invoke these
should call the .ts version directly via bun.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants