Let the person who knows the industry run it, from 20% to 80% - #5
Merged
Conversation
ralyodio
marked this pull request as ready for review
September 6, 2026 06:31
Every collection here is also a market somebody knows better than we do. This is the seller side of that knowledge: a person claims a niche, supervises the agents building for it, and earns a rising share of what it makes. Phase 1 of the PRD: niches, opportunities, claims, membership, contribution events, scoring, the seven-rung ladder, tier history, the public pages and the admin queue. No payment or x402 infrastructure is added — the gateway already in production is untouched, and the contracts the later phases arrive through are defined and tested in packages/knowledge/src/events.js. Impact over volume is the whole design. Score comes only from contributions somebody verified: a submission with nothing checkable attached waits, a claim on money needs an outside reference and is never auto-verified, a duplicate books once against a unique index, and repeating a type pays half, then a quarter, then nothing. Ten thousand submissions of the cheapest thing there is reaches a score under 200, and there is a test that asserts it. Money is integer minor units and integer basis points throughout, capped at 8000. A tier change never rewrites a settled allocation, which is what tier_history is for. Reversal marks the row and leaves its points alone: a status that excludes a row and a compensating negative row would subtract the same points twice and take honest work down with the fraud. The niche page is served from the site root, as the PRD asks. Two things stop it shadowing a real page: the route is registered after every other one, and a niche may not take a slug the site already uses, refused on creation and backed by a shape check in the database. /@handle is answered by the same handler, because Hono does not match a parameter behind a literal prefix inside a segment and /@:handle never fires. Migration is numbered 0007 with 0006 left for the partners branch still in flight. Thirteen niches are opened from this deployment's own collections, unscored: an opportunity score nobody has measured is left null and the page says so rather than printing a number it cannot defend. No new environment variables. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W9NGGLDvNayi6uWheSXDGF
The Dockerfile lists every workspace package.json by hand, so a new one that is not in the list fails the build at bun install. packages/knowledge was missing. Verified by building the image and booting it against Postgres 18 and Redis 8: migrations apply, the niches seed, and the pages serve. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W9NGGLDvNayi6uWheSXDGF
/sell is in the gateway's openPaths because charging a crawler to read our own recruiting page would be an odd way to run a marketplace. /opportunities is the same page for the other side of the marketplace and belongs there too. Both spellings, because the gateway prefix-matches only entries ending in a slash. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01W9NGGLDvNayi6uWheSXDGF
ralyodio
force-pushed
the
worktree-knowledge-influencers
branch
from
September 6, 2026 06:35
39aed00 to
039dc30
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.
Phase 1 of the Knowledge Influencer PRD: a person who knows an industry claims a niche, supervises the agents building for it, and earns a rising share of what it makes — 20% at the start, 80% at the top.
What is here
0007—niches,niche_members,niche_claims,opportunities,contribution_tiers(seeded 20→80),contribution_events,contribution_scores,tier_history,knowledge_audit_logs.packages/knowledge— the domain, pure: no database, no HTTP. Tier resolution, share arithmetic in basis points, the scoring engine, and the Phase 2/3/4 contracts (domainEvent,machineRevenueEvent,attributableNetMinor,allocate).packages/db/src/knowledge.js— every statement the programme runs, exported as@nichedb/db/knowledge./opportunities,/opportunities/<slug>with the claim form,/<niche>,/<niche>/skill.md,/<niche>/manifest.json,/@<handle>,/dashboard/niches,/admin/knowledge./api/v1surface from §22, includingPOST /api/v1/niches/<slug>/contributions.docs/knowledge-influencers.md,docs/revenue-share.md,docs/x402-attribution.md,docs/architecture.md, plus a README section.What is deliberately not here
No payment or x402 infrastructure. The gateway already in production is untouched; the only change to
pricing.jsis adding/opportunitiestoopenPaths, for the same reason/sellis there. The revenue ledger's arithmetic is written and tested — only the tables and the wiring are missing.Decisions worth reviewing
Stack. The PRD assumes Next.js 16 + TypeScript + shadcn + Turso. This repo is Bun + Hono JSX + plain JavaScript + Postgres, so per §32 the work conforms to the repo. Nothing was rebuilt that already existed.
Reuse.
@profullstack/partnersalready runs the other 20–80 programme here (paying people whose writing is in the index for what crawlers take). ItscommissionLadderis additive over property and niche counts and cannot express score thresholds, so the tier table is its own thing — but both cap at 80% and the two ledgers are kept apart on purpose, because conflating a commission on somebody else's traffic with a share of a business you help run makes both impossible to audit.docs/revenue-share.mdsets out the distinction.Migration numbering.
0006is left for the partners branch still in flight, so the two cannot land as the same number and leave the order ambiguous.Routing. The niche page is at the site root as the PRD asks. It cannot shadow a real page: the route registers after every other one, and a niche may not take a reserved slug — refused on creation, with a shape check in the database under it. Verified live against every existing route.
/@handleis answered by the same handler because Hono does not match a parameter behind a literal prefix inside a segment;/@:handlesilently never fires. Found by testing, not by reading.Seeding. Thirteen niches are opened from this deployment's own collections rather than invented industries, and every one is unscored. An opportunity score nobody has measured is left null and the page prints "not scored yet".
Anti-gaming
Impact over volume, in five enforced places: evidence or nothing; a claim on money needs an outside reference and is never auto-verified; duplicates book once against a unique index; repeating a type pays half, then a quarter, then nothing; trust is earned per niche. A test asserts that ten thousand submissions of the cheapest type reaches a score under 200 — a
specialist, not the top rung.A reversal marks the row and leaves its points alone. An earlier draft also wrote a compensating negative row, which subtracted the same points twice and collapsed a legitimate score of 23 to 0. Caught by running the full flow against a real Postgres; there is now a test for it.
Verification
bun test— 87 pass, 0 fail (36 engine, 18 schema against in-process Postgres, plus the existing suite). Needs no server.bun run lint— clean; the two remaining CSS warnings and thebiome.jsondeprecation are pre-existing onmain.No new environment variables.
🤖 Generated with Claude Code
https://claude.ai/code/session_01W9NGGLDvNayi6uWheSXDGF