feat(q2): AI-Native Synthesis MVP — discovery sections from commits + statics#72
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
… statics
Implements the Q2 supporting pillar from
wad-d-instrumentation-genome-2-sequencing.md:
- New `discovery` section type (manifest v2 extension, additive):
`kind: "discovery"` + `sourceTrust: "synthesis"` (new union value),
stored at `.ashlrcode/genome/discoveries/<id>.json`, capped at
DISCOVERY_RETENTION_LIMIT=30 (mirrors commit retention pattern).
- `scripts/genome-synthesizer.ts` — background LLM pass that reads
the last N commit sections + relevant static sections and emits 1-3
structured insights ("3 files use this util wrong", etc). Uses the
existing `servers/_llm-providers/` infrastructure via selectProvider().
CLI: `bun run scripts/genome-synthesizer.ts [--dry-run] [--max-commits=N] [--force]`.
- Tiered cadence (per the plan):
* free → hard-gated OFF at the top of synthesize(); never reaches the LLM
* pro → throttled to once per 7 days per repo via _synthesis-state.json
* team → throttled to once per 24 hours per repo
* --force bypasses throttle for manual runs
- Privacy: only commit-section summaries (user-authored) go to the LLM,
never raw diff content. Paths under secrets/, .env, *.pem, id_rsa,
credentials.json are redacted before prompt construction.
- Wired into ashlr__grep: when discovery sections exist and keywords
match the query, they're prepended under a `## Discoveries` block
ahead of commits and static sections. Backward-compat preserved —
static/commit ordering unchanged when no discoveries exist.
- Strict LLM-response validation: malformed entries (missing summary,
hallucinated SHA, wrong shape) are dropped. Confidence clamped to
[0,1]. Output capped at 3 discoveries per run.
- Tests: 23 new bun:test cases covering tier gating (free never calls
LLM, pro 7d throttle, team 24h throttle, --force bypass), happy path,
malformed-response handling, dry-run no-write contract, no-provider /
llm-failed branches, secret-path redaction, CLI arg parsing, and
grep retrieval wire-up. 3059 plugin / 0 fail.
No new dependencies. CLI-only — never in a hook hot path; respects the
2s hook safety net.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
bf13689 to
751154d
Compare
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
Implements the Q2 supporting pillar from
wad-d-instrumentation-genome-2-sequencing.md— a background LLM pass that converts recent commit sections + relevant static genome sections into AI-synthesized discoveries.discoverysection type (manifest v2 extension, additive):kind: \"discovery\"+sourceTrust: \"synthesis\"(new union value), stored at.ashlrcode/genome/discoveries/<id>.json, capped atDISCOVERY_RETENTION_LIMIT=30(mirrors commit retention).scripts/genome-synthesizer.ts— CLI-only background pass that uses the existingservers/_llm-providers/infrastructure viaselectProvider().ashlr__grep: when discovery sections exist and keywords match, they're prepended under a## Discoveriesblock ahead of commits and static sections. Static/commit ordering unchanged when no discoveries exist.Tier gating (hardcoded at the top of
synthesize())synthesize()returns{ skipped: true, reason: \"free-tier\" }before ever touching the LLM. Even--forcecannot override this..ashlrcode/genome/_synthesis-state.json.--force--dry-runPrivacy
secrets/,.env,*.pem,id_rsa*,credentials.json) are redacted fromfilesChangedlists and stripped from the prompt body before construction.Sample discovery section (illustrative)
{ \"id\": \"9f1c4ae27e8a3d12\", \"summary\": \"Recent activity tightens v1.31 SessionEnd hook diagnostics (hook-health surfacing + onboarding hero) and renames Grok references to grok-4.3 — the WAD-D telemetry path is being prepped without touching the post-commit hot path.\", \"evidence\": [ { \"path\": \"hooks/session-end.ts\" }, { \"path\": \"scripts/install-genome-hooks.ts\", \"lineRange\": [40, 120] }, { \"path\": \"servers/_ask-router.ts\" } ], \"sourceCommits\": [ \"1b1632a036383af3cc21a66f2cd8ac3254474eaf\", \"7b1430c4b44bf5984c805e71fa464721815dfb94\", \"d20bc62a181cc6a8135daa736ffd1e1cf31536b5\" ], \"synthesizedAt\": \"2026-05-22T22:00:00.000Z\", \"confidence\": 0.74 }Files
scripts/genome-synthesizer.ts,servers/_genome-discoveries.ts,__tests__/genome-synthesizer.test.tsservers/_manifest-v2.ts(addedDiscoverySectiontypes,\"synthesis\"toSourceTrust,\"discovery\"tokindunion),servers/_genome-commits.ts(exportedtokenize+ renamedscoreCommit→scoreSectionMetafor reuse),servers/grep-server.ts(prepend discovery block).Strict LLM-response validation
[0, 1].```json) stripped defensively.Test plan
bun:testcases in__tests__/genome-synthesizer.test.ts\"throttled\"--forcebypasses throttle--dry-runwrites no files, no state update, returnswouldWriteIdssecrets/,.envpaths reach the LLM)retrieveDiscoverySectionssurfaces matching discoveries viaashlr__grepbunx tsc --noEmitcleanConstraints honored
main.🤖 Generated with Claude Code