Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion scripts/archive-blog-backlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import { readFileSync, writeFileSync, mkdirSync, renameSync, existsSync } from "
import fg from "fast-glob";
import matter from "gray-matter";

const KB_ROOT = join(__dirname, "..", "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const SOURCES_BLOG = join(KB_ROOT, "sources", "blog");
const ARCHIVE_DATE = "20260411";
const ARCHIVE_ROOT = join(
Expand Down
2 changes: 1 addition & 1 deletion scripts/archive-stubs-backlog.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ import {
import fg from "fast-glob";
import matter from "gray-matter";

const KB_ROOT = join(__dirname, "..", "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const SOURCES_ROOT = join(KB_ROOT, "sources");
const ARCHIVE_DATE = "20260411";
const ARCHIVE_ROOT = join(KB_ROOT, "archive", `stubs-backlog-${ARCHIVE_DATE}`);
Expand Down
2 changes: 1 addition & 1 deletion scripts/archive.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import fg from "fast-glob";
import matter from "gray-matter";
import { InsightFrontmatter } from "./schemas/frontmatter.js";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Types ────────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/ask.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { searchInsights } from "./lib/search";
import { embedText, isOllamaAvailable } from "./lib/embeddings";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Types ──────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/batch-ingest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { generateSourceId } from "./lib/generate-id";
import { parseMarkdownFile } from "./lib/parse-insight";

// ─── Constants ─────────────────────────────────────────────────────────
const KB_ROOT = join(__dirname, "..", "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Types ─────────────────────────────────────────────────────────────
interface SuccessResult {
Expand Down
2 changes: 1 addition & 1 deletion scripts/classify-edges.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ import { initDb } from "./lib/db";
import type { RelationshipTypeValue } from "./schemas/frontmatter";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const BATCH_SIZE = 20;

// ─── Types ───────────────────────────────────────────────────────────
Expand Down
3 changes: 1 addition & 2 deletions scripts/compress.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,7 @@ import matter from "gray-matter";
import { initDb, getConnectionsForInsights } from "./lib/db";
import { computePageRank } from "./lib/pagerank";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Types ───────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/create-principles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { slugify } from "./lib/ingest/slug.js";
import { safeLogEntry } from "./lib/log.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Schema ──────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/create-tensions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { generateTensionId } from "./lib/generate-id.js";
import { slugify } from "./lib/ingest/slug.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const TENSIONS_DIR = join(KB_ROOT, "tensions");
const CANDIDATES_PATH = join(KB_ROOT, "meta", "tension-candidates.json");

Expand Down
2 changes: 1 addition & 1 deletion scripts/daemon.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ import type Database from "better-sqlite3";
// ─── Configuration ──────────────────────────────────────────────────

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const INBOX_DIR = join(KB_ROOT, "inbox");
const PROCESSED_DIR = join(INBOX_DIR, "processed");
const REVIEW_DIR = join(INBOX_DIR, "review");
Expand Down
2 changes: 1 addition & 1 deletion scripts/decide.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { slugify } from "./lib/ingest/slug.js";
import { safeLogEntry, normalizeBodyLine } from "./lib/log.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Write Result ───────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/dedup-insights.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import { Readability } from "@mozilla/readability";
// ─── Config ──────────────────────────────────────────────────────────

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const DB_PATH = join(KB_ROOT, "db", "brain.db");
const ARCHIVE_DIR = join(KB_ROOT, "archive", "dedup-260405");
const LOG_PATH = join(KB_ROOT, "meta", "dedup-log.json");
Expand Down
2 changes: 1 addition & 1 deletion scripts/embed.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { isOllamaAvailable, embedText } from "./lib/embeddings";
import { initVectorTable, upsertEmbedding } from "./lib/vector-search";
import { PrincipleFrontmatter, type PrincipleData } from "./schemas/frontmatter";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const EMBEDDING_MODEL = "nomic-embed-text";

// ─── Types ───────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion scripts/extract.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { writeInsights } from "./lib/extract/write-insights.js";
import { safeLogEntry } from "./lib/log.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Helpers ──────────────────────────────────────────────────────────

Expand Down
3 changes: 1 addition & 2 deletions scripts/inbox-feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@ import fg from "fast-glob";
import matter from "gray-matter";
import { initDb } from "./lib/db";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const META_DIR = join(KB_ROOT, "meta");
const FEEDBACK_PATH = join(META_DIR, "inbox-feedback.json");

Expand Down
3 changes: 1 addition & 2 deletions scripts/inbox-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,7 @@ import { initDb } from "./lib/db";
import type Database from "better-sqlite3";

const PORT = parseInt(process.env.ZUHN_INBOX_PORT ?? "7777", 10);
const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const INBOX_DIR = join(KB_ROOT, "inbox");

let db: Database.Database;
Expand Down
2 changes: 1 addition & 1 deletion scripts/ingest-channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ import { ingestYouTube } from "./lib/ingest/youtube";
import { slugify } from "./lib/ingest/slug";

// ─── Constants ─────────────────────────────────────────────────────────
const KB_ROOT = join(__dirname, "..", "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const META_DIR = join(KB_ROOT, "meta");
const DEFAULT_TOP = 50;
const DEFAULT_DELAY = 3;
Expand Down
3 changes: 1 addition & 2 deletions scripts/init.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,7 @@
import { existsSync, mkdirSync, writeFileSync, rmSync } from "node:fs";
import { join } from "node:path";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

const force = process.argv.includes("--force");

Expand Down
2 changes: 1 addition & 1 deletion scripts/learn.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import {
} from "./lib/learning";
import { predictLinks, writePredictedLinks } from "./lib/common-neighbors";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

async function main(): Promise<void> {
console.log("╔══════════════════════════════════════╗");
Expand Down
2 changes: 1 addition & 1 deletion scripts/lib/brief.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ export type BriefRenderMode = "full" | "concise";

// ─── Helpers ────────────────────────────────────────────────────────

const KB_ROOT = join(__dirname, "../../knowledge-base");
import { KB_ROOT } from "./kb-root";

/** Resolve an INS- ID to its domain via the database. */
function insightDomain(
Expand Down
2 changes: 1 addition & 1 deletion scripts/lib/db.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import type { InsightData } from "../schemas/frontmatter";

// ─── Paths ──────────────────────────────────────────────────────────

const KB_ROOT = join(__dirname, "../../knowledge-base");
import { KB_ROOT } from "./kb-root";
const DB_DIR = join(KB_ROOT, "db");
const DB_PATH = join(DB_DIR, "brain.db");

Expand Down
2 changes: 1 addition & 1 deletion scripts/lib/log.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ export type LogAction = (typeof LOG_ACTIONS)[number];

// ─── Default log path ───────────────────────────────────────────────

const KB_ROOT = join(__dirname, "../../knowledge-base");
import { KB_ROOT } from "./kb-root";
const DEFAULT_LOG_PATH = join(KB_ROOT, "meta", "log.md");

// ─── File header ────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion scripts/mcp-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import { initVectorTable, hybridSearch } from "./lib/vector-search";

// ─── Constants ───────────────────────────────────────────────────────

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const PROJECT_ROOT = join(__dirname, "..");

// ─── Server Setup ────────────────────────────────────────────────────
Expand Down
3 changes: 1 addition & 2 deletions scripts/merge-topics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@ import { mkdirSync } from "node:fs";
import { join } from "node:path";
import matter from "gray-matter";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

function usage(): never {
console.error("Usage: merge-topics.ts --source <domain/topic> --target <domain/topic> [--dry-run]");
Expand Down
2 changes: 1 addition & 1 deletion scripts/mindmap.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { writeFile, mkdir } from "node:fs/promises";
import { scanInsights } from "./lib/generate-index.js";
import type { ParseSuccess } from "./lib/parse-insight.js";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const VIEWS_DIR = join(KB_ROOT, "views");

// ─── Scalability note ────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion scripts/predict.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import { slugify } from "./lib/ingest/slug.js";
import { safeLogEntry, normalizeBodyLine } from "./lib/log.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Write Result ───────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/quality-score.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ import { initDb } from "./lib/db";
import { initVectorTable } from "./lib/vector-search";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const SCORES_FILE = join(KB_ROOT, "meta", "quality-scores.jsonl");

// ─── Types ──────────────────────────────────────────────────────────
Expand Down
2 changes: 1 addition & 1 deletion scripts/red-team.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import fg from "fast-glob";
import matter from "gray-matter";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const META_DIR = join(KB_ROOT, "meta");
const BOUNTIES_PATH = join(META_DIR, "bounties.json");
const HISTORY_PATH = join(META_DIR, "red-team-history.json");
Expand Down
2 changes: 1 addition & 1 deletion scripts/reindex.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import type { ParseSuccess } from "./lib/parse-insight.js";
import { initDb, upsertInsight, getAllInsights } from "./lib/db.js";
import { SourceFrontmatter, PrincipleFrontmatter } from "./schemas/frontmatter.js";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Helpers ──────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/resolve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import matter from "gray-matter";
import { safeLogEntry, normalizeBodyLine } from "./lib/log.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Valid transitions ───────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/resurface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { join } from "node:path";
import { writeFile, mkdir } from "node:fs/promises";
import { initDb, type InsightRow } from "./lib/db";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const VIEWS_DIR = join(KB_ROOT, "views");
const META_DIR = join(KB_ROOT, "meta");

Expand Down
2 changes: 1 addition & 1 deletion scripts/resurrect.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { rename, readFile, writeFile, mkdir } from "node:fs/promises";
import fg from "fast-glob";
import matter from "gray-matter";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Main ─────────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/scout-gaps.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { join } from "node:path";
import fg from "fast-glob";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const META_DIR = join(KB_ROOT, "meta");
const BOUNTIES_PATH = join(META_DIR, "bounties.json");
const FLAGS_PATH = join(META_DIR, "flags.md");
Expand Down
2 changes: 1 addition & 1 deletion scripts/scout-predictions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ import fg from "fast-glob";
import matter from "gray-matter";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const META_DIR = join(KB_ROOT, "meta");
const EVIDENCE_PATH = join(META_DIR, "prediction-evidence.json");

Expand Down
2 changes: 1 addition & 1 deletion scripts/scrub-archived-refs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import { join } from "node:path";
import fg from "fast-glob";
import matter from "gray-matter";

const KB_ROOT = join(__dirname, "..", "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

async function main(): Promise<void> {
const archivedIds = process.argv.slice(2);
Expand Down
2 changes: 1 addition & 1 deletion scripts/sleep.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { execFileSync } from "node:child_process";
import { SessionState } from "./schemas/session.js";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const SESSION_PATH = join(KB_ROOT, "meta", "session.md");

// ─── Helpers ──────────────────────────────────────────────────────────
Expand Down
3 changes: 1 addition & 2 deletions scripts/split-topic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { readFileSync, writeFileSync, mkdirSync, renameSync, existsSync } from "
import { join, basename } from "node:path";
import matter from "gray-matter";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";

// ─── Helpers ──────────────────────────────────────────────────────────

Expand Down
2 changes: 1 addition & 1 deletion scripts/views.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import fg from "fast-glob";
import matter from "gray-matter";
import { initDb, type InsightRow } from "./lib/db";

const KB_ROOT = join(__dirname, "../knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const VIEWS_DIR = join(KB_ROOT, "views");
const FLAGS_PATH = join(KB_ROOT, "meta", "flags.md");
const SOURCES_DIR = join(KB_ROOT, "sources");
Expand Down
3 changes: 1 addition & 2 deletions scripts/wake.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import { readFileSync, readdirSync, existsSync } from "node:fs";
import { join } from "node:path";
import matter from "gray-matter";

const PROJECT_ROOT = join(__dirname, "..");
const KB_ROOT = join(PROJECT_ROOT, "knowledge-base");
import { KB_ROOT } from "./lib/kb-root";
const META = join(KB_ROOT, "meta");

// ─── Helpers ──────────────────────────────────────────────────────────
Expand Down
Loading