mirror of
https://github.com/bitbaum/loki.git
synced 2026-12-05 13:37:18 +01:00
The second half of the frontier loop, and the differentiated one: turn each day's digest into concrete proposals for how FleetCrown should evolve. The loop AUTO-PROPOSES ONLY — a human accepts (→ a roadmap goal) or dismisses; it never builds on its own (building straight from a news feed is exactly the ungoverned action to avoid). Decision history grounds the next run so nothing is re-proposed. Brain (src/lib/frontier/propose.ts): - generateProposals — Groq, grounded in FleetCrown's mission + the owner's active goals + already-considered titles. Returns ≤3 specific proposals, each tying a real frontier item to a FleetCrown capability; empty list is the correct (and common) answer. sourceUrls validated against the real digest. - critiqueProposals — an adversarial reviewer that defaults to REJECTING and scores 0-100; only ≥70 reach a human. The `model` param is the cross-model verification swap point (callGroqText now takes a model override): point the judge at a different model than the generator for uncorrelated errors. - Code-level Jaccard dedup as a net beyond the LLM instruction. Wiring: - run.ts runFrontierProposals: target = owner of the "fleetcrown" entity (resolved, not hardcoded) → generate → critique → store survivors. - The daily cron runs it after the digest (best-effort; never fails the digest). - frontier_proposals table (status proposed|accepted|dismissed, score, links). - /api/frontier/proposals (GET list) + /[id] (POST accept→createGoal / dismiss), owner-gated via requirePrivateApiAccess. - /system: FrontierProposalsCard inbox (server read) + ProposalRow (client Accept/Dismiss). Accept reuses createGoal; provenance links fold into the goal. Verified: tsc=0, eslint=0; full local run drafted 3 / surfaced 3 real proposals (78-90) from today's arXiv items; accept→goal path tested + cleaned up. Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
27 lines
1.1 KiB
TypeScript
27 lines
1.1 KiB
TypeScript
// Manually generate today's frontier digest (same path the daily cron runs).
|
|
// Useful for seeding the first digest and for iterating on ranking quality.
|
|
//
|
|
// DATABASE_URL=... GROQ_API_KEY=... npx tsx scripts/seed-frontier.ts
|
|
|
|
import { runFrontierDigest, runFrontierProposals } from "@/lib/frontier/run";
|
|
|
|
async function main() {
|
|
const r = await runFrontierDigest();
|
|
console.log(`✓ frontier digest ${r.saved.digestDate} (model: ${r.saved.model})`);
|
|
console.log(` ${r.itemCount} items / ${r.candidateCount} candidates / ${r.sourcesOk} sources ok, ${r.sourcesFailed} failed`);
|
|
console.log(` headline: ${r.saved.headline}`);
|
|
for (const it of r.saved.items) {
|
|
console.log(` • [${it.category}] ${it.title}`);
|
|
}
|
|
|
|
console.log("\n— self-improvement proposals —");
|
|
const p = await runFrontierProposals(r.saved);
|
|
if (p.skipped) {
|
|
console.log(` skipped: ${p.skipped}`);
|
|
} else {
|
|
console.log(` drafted ${p.drafted}, surfaced ${p.surfaced} (cleared the critique bar)`);
|
|
}
|
|
}
|
|
|
|
main().then(() => process.exit(0)).catch((e) => { console.error(e); process.exit(1); });
|