From 2e0bfbabf37462c57ea924eb70e44426c172cff8 Mon Sep 17 00:00:00 2001 From: Anthony Ettinger Date: Sun, 22 Nov 2026 13:29:44 +0000 Subject: [PATCH] fix(intent): GitHub opt-in, score first 2k chars, help-first reply drafts Live sweep after #466 found 4 leads; the top 'Hot' (72) was a maintainer's internal docs-review issue that named two competitors deep in an 8k-char body. GitHub issues are now opt-in per watch, native posts are scored on the title + first 2,000 chars, and reply drafts must open with concrete help and carry at most one plain disclosure (the first live draft led with the pitch). Co-Authored-By: Claude Opus 5.5 --- app/(app)/dashboard/intent/page.tsx | 4 ++-- lib/intent/native.ts | 12 ++++++++---- lib/intent/reply.ts | 2 ++ tests/intent-native.test.ts | 9 ++++++++- 4 files changed, 20 insertions(+), 7 deletions(-) diff --git a/app/(app)/dashboard/intent/page.tsx b/app/(app)/dashboard/intent/page.tsx index a19d6c34..041fe53f 100644 --- a/app/(app)/dashboard/intent/page.tsx +++ b/app/(app)/dashboard/intent/page.tsx @@ -294,7 +294,7 @@ function WatchForm({ watch?: WatchLike; }) { const on = (s: string) => - watch?.sources.length ? watch.sources.includes(s) : s === "github" || INTENT_SOURCES.find((x) => x.id === s)?.defaultOn; + watch?.sources.length ? watch.sources.includes(s) : INTENT_SOURCES.find((x) => x.id === s)?.defaultOn; return (

{title}

@@ -336,7 +336,7 @@ function WatchForm({
Communities
- {[...INTENT_SOURCES, { id: "github", label: "GitHub issues", defaultOn: true }].map((s) => ( + {[...INTENT_SOURCES, { id: "github", label: "GitHub issues (feature requests)", defaultOn: false }].map((s) => ( diff --git a/lib/intent/native.ts b/lib/intent/native.ts index 5a16162b..89c04d54 100644 --- a/lib/intent/native.ts +++ b/lib/intent/native.ts @@ -58,7 +58,7 @@ async function searchHN(term: string, sinceSec: number): Promise { url: `https://news.ycombinator.com/item?id=${id}`, title: strip(title), snippet: body.slice(0, 600), - body: body.slice(0, 8000), + body: body.slice(0, 2000), postedAt: typeof h.created_at_i === "number" ? new Date(h.created_at_i * 1000) : null, }; }); @@ -77,7 +77,7 @@ async function searchStackOverflow(term: string, sinceSec: number): Promise { url: String(i.html_url), title: String(i.title ?? ""), snippet: strip(i.body as string).slice(0, 600), - body: strip(i.body as string).slice(0, 8000), + body: strip(i.body as string).slice(0, 2000), postedAt: i.created_at ? new Date(String(i.created_at)) : null, })); } @@ -117,10 +117,14 @@ export async function sweepNative(input: { const sinceSec = Math.floor(since.getTime() / 1000); const want = (id: string, group: string) => !input.sources?.length || input.sources.includes(id) || input.sources.includes(group); + // GitHub is opt-in: most issues are maintainers' own to-do lists and reports, + // and the first live sweep scored one of those "Hot" (an internal docs review + // that named two competitors). Only search it when the watch picks it. + const wantGitHub = !!input.sources?.includes("github"); const searches: Array<[string, (t: string) => Promise]> = []; if (want("hn", "forums")) searches.push(["Hacker News", (t) => searchHN(t, sinceSec)]); if (want("stackoverflow", "forums")) searches.push(["Stack Overflow", (t) => searchStackOverflow(t, sinceSec)]); - if (want("github", "github")) searches.push(["GitHub", (t) => searchGitHub(t, since)]); + if (wantGitHub) searches.push(["GitHub", (t) => searchGitHub(t, since)]); const notes: string[] = []; const seen = new Set(); diff --git a/lib/intent/reply.ts b/lib/intent/reply.ts index 1a7f9c58..7fb80c2e 100644 --- a/lib/intent/reply.ts +++ b/lib/intent/reply.ts @@ -16,6 +16,8 @@ The person replying sells something that may help the author. Write the reply th Rules: - Answer the author's actual question first, with something genuinely useful even if they never buy. +- The first two sentences must be concrete help (a step, a check, a tool category, a pitfall) and must not name the product. +- Never write "this is the right fit" or any sales line; one plain disclosure ("I build X, which does Y") at the end is the most allowed. - Mention the product at most once, plainly, and say you make it ("I build X"), never pretend to be a neutral user. - If the product is not a good fit for what they asked, do not mention it at all; just help. - 40 to 120 words. Plain text. No hashtags, no emoji, no bullet lists, no greeting like "Great question". diff --git a/tests/intent-native.test.ts b/tests/intent-native.test.ts index f82cbeac..6189671d 100644 --- a/tests/intent-native.test.ts +++ b/tests/intent-native.test.ts @@ -19,7 +19,7 @@ afterEach(() => vi.unstubAllGlobals()); describe("sweepNative", () => { it("searches HN, Stack Overflow and GitHub and scores the results", async () => { vi.stubGlobal("fetch", vi.fn(async (url: string) => new Response(JSON.stringify(respond(url)), { status: 200 }))); - const r = await sweepNative({ terms: ["AEO audit"], keywords: ["AEO audit"], days: 7, minIntent: 1, now }); + const r = await sweepNative({ terms: ["AEO audit"], keywords: ["AEO audit"], sources: ["forums", "github"], days: 7, minIntent: 1, now }); expect(r.calls).toBe(3); const sources = r.hits.map((h) => h.source); expect(sources).toContain("hn"); @@ -27,6 +27,13 @@ describe("sweepNative", () => { expect(r.hits.find((h) => h.source === "hn")!.url).toBe("https://news.ycombinator.com/item?id=1"); }); + it("leaves GitHub out unless the watch opts in", async () => { + const f = vi.fn(async (url: string) => new Response(JSON.stringify(respond(url)), { status: 200 })); + vi.stubGlobal("fetch", f); + await sweepNative({ terms: ["x"], keywords: ["x"], days: 7, minIntent: 0, now }); + expect(f.mock.calls.some((c) => String(c[0]).includes("api.github.com"))).toBe(false); + }); + it("respects the watch's source selection", async () => { const f = vi.fn(async (url: string) => new Response(JSON.stringify(respond(url)), { status: 200 })); vi.stubGlobal("fetch", f);