Skip to content

Optimize rule injection caches#8

Merged
code-yeongyu merged 8 commits into
mainfrom
ulw/rule-comment-baseline-20260518
May 18, 2026
Merged

Optimize rule injection caches#8
code-yeongyu merged 8 commits into
mainfrom
ulw/rule-comment-baseline-20260518

Conversation

@code-yeongyu
Copy link
Copy Markdown
Owner

@code-yeongyu code-yeongyu commented May 18, 2026

Summary

  • Cache compiled glob matchers for rule matching.
  • Dedupe dynamic rule loading work.
  • Preserve nested dynamic project roots.
  • Bound matcher and dynamic match caches.

Improvement table

Area Baseline before this PR Final pinned behavior Delta / proof
Repeated glob matching Repeated calls could recompile the same glob set. 20 repeated matches keep entries: 1, compiledPatterns: 2. Compile work reduced to one cached pattern set; pinned in test/matcher.test.ts.
Duplicate dynamic targets Three duplicate targets could repeat project-root, discovery, and rule-read work per target. findProjectRoot: 1, findCandidates: 1, readFile: 1 for three duplicate targets. Deterministic work counters reduced from per-target repetition to one pass; pinned in test/engine.test.ts.
Repeated unchanged match decisions Same target/rule body could re-run matching on repeated dynamic calls. matchRuleCalls remains 1 across two calls. Repeated unchanged decision avoids the second match pass; pinned in test/engine.test.ts.
Cache resource bound Matcher cache size was not pinned by test. Matcher cache stays <= 256 entries. Memory growth bounded; pinned in test/matcher.test.ts.

Verification

  • npm test
  • npm run check
  • npm pack --dry-run
  • no-excuse TypeScript gate

Review

  • Security, QA, context, and goal-verifier lanes completed locally.
  • Cubic review passed before merge.

code-yeongyu and others added 5 commits May 18, 2026 11:52
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Copy link
Copy Markdown

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

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

No issues found across 5 files

Re-trigger cubic

code-yeongyu and others added 3 commits May 18, 2026 13:12
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
@code-yeongyu code-yeongyu merged commit 0625076 into main May 18, 2026
6 checks passed
@code-yeongyu code-yeongyu deleted the ulw/rule-comment-baseline-20260518 branch May 18, 2026 04:36
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.

1 participant