Skip to content

feat: large repo scaling — dedup, proportional budget, time-decay, package detection, context-augmented training - #29

Open
bearmug wants to merge 1 commit into
mainfrom
feat/large-repo-scaling
Open

feat: large repo scaling — dedup, proportional budget, time-decay, package detection, context-augmented training#29
bearmug wants to merge 1 commit into
mainfrom
feat/large-repo-scaling

Conversation

@bearmug

@bearmug bearmug commented May 16, 2026

Copy link
Copy Markdown
Contributor

Summary

Improves repo-arch for large monorepos (validated on fiale-plus/pi with 4089 commits across 1542 files).

Changes

git-history.ts (+20/-3)

  • SHA-based deduplication in mineHistory(): prevents duplicate commits when history is re-mined
  • Package detection (packages/*, apps/*, libs/* workspaces): each commit gets a packageId
  • fileDedupKey() utility for stable dedup across files

cards.ts (+123/-19)

  • Time-decayed scoring: timeDecay() applies exponential decay (half-life: 180d fixes/churn, 365d arch). Minimum decay floor of 0.5 prevents cards from vanishing.
  • Proportional card budget: computeCardBudget() scales with repo size — 20 + n/200 commits, max 200. Large repos get proportionally more cards.
  • Bounded suggestion text: boundedSuggestion() limits to 3 example commit subjects (was: all subjects, producing 50KB+ card text).
  • Package tagging: cards now carry packageId and decayedScore for filtering/grouping.

training.ts (+36/-7)

  • Context-augmented training: --context-format flag wraps examples in card context (context + question -> answer instead of plain question -> answer).
  • formatCardContext() renders structured card metadata as context blocks.

Testing

All 79 existing tests pass. Verified on fiale-plus/pi (monorepo, 4089 commits):

  • Before: 20 cards (hardcoded max), suggestion text included all commit subjects
  • After: 25+ cards (proportional budget), compact suggestions, time-decayed confidence

- git-history.ts: SHA-based dedup in mineHistory, package detection
  (packages/|apps/|libs/ workspaces), dedupKey utility
- cards.ts: time-decayed scoring (half-life: 180d fixes/churn, 365d arch),
  proportional card budget scaling (20 + n/200 commits, max 200),
  bounded suggestion text (max 3 example subjects), package tagging,
  min decay floor to prevent cards from vanishing
- training.ts: contextFormat option for context-augmented training data,
  formatCardContext helper for structured card rendering

The combination: large repos (10k+ commits) now get proportionally more
cards, time-decayed scores favor recent activity, suggestion text is
compact, and training data can be generated in context+question format.
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