feat: consolidate SiteContext into SITE.md with auto-refresh#875
Merged
feat: consolidate SiteContext into SITE.md with auto-refresh#875
Conversation
SITE.md was meant to replace SiteContext but both systems remained, injecting site context into every AI call twice (SITE.md at priority 20 as static markdown, SiteContextDirective at priority 80 as live JSON). This consolidation: - Enriches SITE.md scaffold with all SiteContext data: post counts per type, taxonomy term counts with hierarchy/associations, language, timezone, permalink structure — rendered as markdown tables - Adds datamachine_regenerate_site_md() with 60-second debounce transient to auto-refresh SITE.md on structural changes (same hooks SiteContext used: save_post, switch_theme, activated_plugin, etc.) - Preserves user-added content below <!-- CUSTOM --> marker - Deprecates SiteContext class and SiteContextDirective to no-ops (kept for backward compat, will be removed in a future major version) - Removes SiteContextDirective from the directive chain — no more duplicate site context in AI prompts - Repurposes site_context_enabled setting to control SITE.md auto-refresh - Cleans up legacy SiteContext transient on activation Single source of truth: SITE.md, injected once via CoreMemoryFilesDirective. Closes #871.
Homeboy Results —
|
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
save_post,switch_theme,activated_plugin, etc.) with 60-second debounce.Before → After
Changes across 5 files
migrations.phpdatamachine_get_site_scaffold_content()with post/taxonomy tables, language, timezone, permalinks. Addeddatamachine_regenerate_site_md()with debounce + custom content preservation. Addeddatamachine_register_site_md_invalidation()hook registration.bootstrap.phpdatamachine_register_site_md_invalidation()SiteContext.phpSiteContextDirective.phpdata-machine.phpdatamachine_regenerate_site_md()on activation + cleans up legacy transientSample enriched SITE.md output
Testing
php -lsyntax checksite_context_enabledsetting repurposed to control SITE.md auto-refresh<!-- CUSTOM -->marker is preserved across regenerationsBackward Compatibility
SiteContextclass andSiteContextDirectiveclass are deprecated, not deleteddatamachine_site_contextanddatamachine_site_context_directivefilters no longer fire (no known consumers)Closes #871. Related: #872 (additional enrichment beyond SiteContext data).