Monthly Pathfinder gap-analysis automation#96
Open
jpr5 wants to merge 3 commits into
Open
Conversation
…ctionable doc gaps Analyzes the trailing 30 days of analytics queries, clusters low-confidence and unanswered queries by topic, and uses the Anthropic SDK to summarize each cluster into a named knowledge gap. Hardened against malformed LLM output: recovers object-wrapped and multi-array gap shapes order-independently, caps and de-duplicates same-key gaps so alerts stay bounded, escapes untrusted query text in the prompt, persists gap state before alerting, and scopes the state lineage to the default scheduled branch with broken-chain detection. Includes the cluster helper and full unit-test coverage.
Adds the monthly-gap-analysis GitHub Action (30-day lookback, analytics-API based) that runs the tool on a cron and alerts on detected gaps. Extends the static-quality workflow to prettier-check the gap-analysis scripts and adds a typecheck-scripts job, since the root tsconfig excludes scripts/ and never type-checked the shipped scheduled scripts.
Adds tsconfig.scripts.json, which type-checks scripts/gap-analysis (and its tests) without emitting, since the root tsconfig is scoped to src/. Adds the Anthropic SDK as a devDependency (it is only used by the scheduled script, not the published runtime) and excludes all tsconfig*.json from the npm tarball so the new scripts config does not ship.
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
Required configuration (before enabling)
PATHFINDER_ANALYTICS_TOKEN(analytics API bearer),ANTHROPIC_API_KEY(optional — LLM classification; falls back to deterministic clustering if unset),NOTION_TOKEN(report publishing).SLACK_WEBHOOK_OSS_ALERTSorg secret.actions: read(cross-run artifact download for the prior-state baseline).Notes
scripts/gap-analysis/is excluded from the npm tarball (.npmignore);@anthropic-ai/sdkis a devDependency (only this CI script uses it, dynamically imported).tsconfig.scripts.json; 93 unit tests cover clustering, LLM-output recovery, dedup/cap, the dry-run contract, and prompt-injection escaping of untrusted query text.Test plan
workflow_dispatchdry-run to verify analytics fetch + report generation without alerting.