Skip to content

feat(knowledge): implement knowledge store layer#8

Open
milarze wants to merge 2 commits into
mainfrom
spec-02-knowledge-store
Open

feat(knowledge): implement knowledge store layer#8
milarze wants to merge 2 commits into
mainfrom
spec-02-knowledge-store

Conversation

@milarze

@milarze milarze commented Jul 3, 2026

Copy link
Copy Markdown
Owner

Overview

Implements the knowledge management layer that provides cached read/write access to site configs, user models, and discovered patterns. This layer sits between the storage layer and the tools layer.

Changes

  • KnowledgeStore: Main entry point with RwLock-based in-memory caching
  • SiteConfigManager: Site-specific parsing configs with defaults for popular recipe sites
  • UserModelManager: User preference learning from recipe interactions
  • PatternMatcher: Success and anti-pattern detection for scraping guidance
  • KnowledgeContextAssembler: LLM prompt injection within token budgets

Testing

  • 58 new unit tests for the knowledge module
  • All 135 tests pass
  • All clippy warnings resolved

@milarze milarze changed the title feat(knowledge): implement knowledge store layer (spec 02) feat(knowledge): implement knowledge store layer Jul 3, 2026
Add knowledge management layer with in-memory caching:

- KnowledgeStore with RwLock-based caching for thread safety
- SiteConfigManager with defaults for popular recipe sites
- UserModelManager for preference learning from recipe interactions
- PatternMatcher for success/anti-pattern detection
- KnowledgeContextAssembler for LLM prompt injection

All 135 tests pass, including 58 new knowledge module tests.
@milarze milarze force-pushed the spec-02-knowledge-store branch from a13f1ed to e2726d7 Compare July 3, 2026 09:07
Priority 1 - Critical Issues:
- Fix race condition in cache access (TOCTOU vulnerability)
- Fix division by zero in preference matching
- Fix flawed merge logic in site config
- Remove dead code suppression

Priority 2 - Logic Bugs:
- Improve pattern matching with proper path boundaries
- Fix difficulty preference to track frequency not recency

Priority 3 - Architecture:
- Add TTL-based cache eviction (5-minute default)
- Create MockKnowledgeStorage for faster unit tests

Priority 4 - Code Quality:
- Replace minimal User-Agent with realistic Chrome string
- Add comprehensive documentation to magic numbers
- Fix comment/code mismatches

Tests: 155 passed (up from 142)
Clippy: 0 warnings
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