From c098f20872919725658794996315ca2ace9eae44 Mon Sep 17 00:00:00 2001 From: "shumeiko.it" Date: Sun, 1 Nov 2026 00:42:48 +0100 Subject: [PATCH] chore: drop hive-mind provenance notes from comments (P2.2) Comments that pointed at hive-mind-core files, the hive-mind OSS mirror and its drift triage now describe the code as it is. The in-process reranker caches its model in ~/.waggle/models, like the embedder, when the caller passes no directory; the sidecar always passes one. --- apps/web/src/lib/frame-source.ts | 3 +-- apps/web/src/lib/harvest-kind-map.ts | 3 +-- apps/web/src/lib/launcher-prompt-args.ts | 2 +- apps/web/src/lib/memory-text-normalize.ts | 3 +-- .../agent/src/long-task/context-manager.ts | 4 ++-- packages/agent/src/tool-output-compressor.ts | 5 ++--- .../core/src/embeddings/embedding-provider.ts | 7 ++----- packages/core/src/logger.ts | 8 +++----- .../core/src/recall/inprocess-reranker.ts | 2 +- .../core/src/recall/resolve-relative-date.ts | 2 +- packages/core/src/workspace-manager.ts | 1 - .../embeddings/embedding-provider.test.ts | 19 +++---------------- .../embeddings/inprocess-embedder.test.ts | 14 +++----------- packages/core/tests/logger.test.ts | 7 +++---- packages/core/tests/workspace-manager.test.ts | 1 - packages/server/src/local/dream-journal.ts | 3 --- packages/server/src/local/routes/embedding.ts | 4 ++-- packages/shared/src/risk.ts | 6 +++--- packages/shared/src/types.ts | 2 +- tests/placeholder-audit.test.ts | 7 ------- 20 files changed, 30 insertions(+), 73 deletions(-) diff --git a/apps/web/src/lib/frame-source.ts b/apps/web/src/lib/frame-source.ts index 7bec80c..67cd00d 100644 --- a/apps/web/src/lib/frame-source.ts +++ b/apps/web/src/lib/frame-source.ts @@ -1,8 +1,7 @@ /** * frame.source provenance vocabulary. * - * The `memory_frames.source` column persists exactly 5 values (the DB CHECK - * constraint at `packages/hive-mind-core/src/mind/schema.ts:57`). The server + * The memory `source` field carries exactly 5 values. The server * projects the raw string; the FE owns the friendly label/description map * (recon 01 §5). Single source of truth for the ⬡ provenance pill across * Workspace Overview, Chat activity steps, and the Memory-Trust screen. diff --git a/apps/web/src/lib/harvest-kind-map.ts b/apps/web/src/lib/harvest-kind-map.ts index 82f2830..2fecdfc 100644 --- a/apps/web/src/lib/harvest-kind-map.ts +++ b/apps/web/src/lib/harvest-kind-map.ts @@ -4,8 +4,7 @@ // `@waggle/shared`, mirroring the memory contract's kinds). This module maps each kind to (a) a human label for Memory // Center filter chips / cards (S04) and (b) an onboarding Memory Review grouping // bucket (S16). The server-side `ImportItemType → MemoryKind` normalization lives -// in the sidecar harvest layer (Phase 2B), NOT here — the build order forbids -// `@waggle/shared` from importing the hive-mind-core `ImportItemType` union. +// in the sidecar harvest layer (Phase 2B), NOT here. // // Pure functions only; no side effects. The `Record` map is the // safety net: tsc fails if a new `MemoryKind` member is added without a mapping. diff --git a/apps/web/src/lib/launcher-prompt-args.ts b/apps/web/src/lib/launcher-prompt-args.ts index d1de1b6..0d62df0 100644 --- a/apps/web/src/lib/launcher-prompt-args.ts +++ b/apps/web/src/lib/launcher-prompt-args.ts @@ -53,7 +53,7 @@ export function promptArgsForTool(toolId: string, prompt: string): string[] | nu case 'claude-code': return ['--print', p]; - // OpenClaw: Claude Code fork (hive-mind-hooks-openclaw exists). + // OpenClaw: Claude Code fork. // Same --print flag inherited from the upstream CLI convention. case 'openclaw': return ['--print', p]; diff --git a/apps/web/src/lib/memory-text-normalize.ts b/apps/web/src/lib/memory-text-normalize.ts index 8836b9f..13500c9 100644 --- a/apps/web/src/lib/memory-text-normalize.ts +++ b/apps/web/src/lib/memory-text-normalize.ts @@ -1,8 +1,7 @@ /** * W4B (F22) — shared memory-text normalizer for DISPLAY-LAYER dedup. * - * The substrate (`packages/hive-mind-core/src/mind/frames.ts` `findDuplicate`) - * dedupes only on an exact content hash, so two writes that differ by a single + * The memory store dedupes only on exact text in the same scope, so two writes that differ by a single * embedded volatile token — a benchmark/audit-run id, a UUID, a timestamp — land * as separate frames and surface to the user as near-identical duplicates. * diff --git a/packages/agent/src/long-task/context-manager.ts b/packages/agent/src/long-task/context-manager.ts index 011809f..ccc57f7 100644 --- a/packages/agent/src/long-task/context-manager.ts +++ b/packages/agent/src/long-task/context-manager.ts @@ -30,8 +30,8 @@ * defaults to estimateStringTokens (no new package deps). * 2. Compression LLM-call cost → threshold-gated (default 0.7), caller * chooses summarizationModel, cost telemetry via onCompressionEvent. - * 3. Hive-mind retrieval ↔ Memory Sync Repair conflict → ContextManager - * does NOT touch hive-mind; consumes RetrievalSearchFn abstraction; + * 3. Retrieval ↔ memory store conflict → ContextManager does NOT touch + * the memory store; consumes RetrievalSearchFn abstraction; * caller wires it to per-task SessionStore (scratch, NOT synced). * 4. Decision history compression dropping critical decisions → bucket- * summarize preserves Decision shape; optional archiveDecisionsTo diff --git a/packages/agent/src/tool-output-compressor.ts b/packages/agent/src/tool-output-compressor.ts index ebda90b..612f7e8 100644 --- a/packages/agent/src/tool-output-compressor.ts +++ b/packages/agent/src/tool-output-compressor.ts @@ -160,9 +160,8 @@ export function truncateToTokenBudget(text: string, maxTokens: number): string { } // ── Near-duplicate text dedup (for live search snippets) ────────────────── -// Mirrors the trigram-cosine in packages/hive-mind-core/src/harvest/dedup.ts; -// kept local so this module stays a standalone pure utility (the harvest copy -// operates on DistilledKnowledge, not arbitrary result items). +// Trigram cosine similarity, kept local so this module stays a standalone pure +// utility. function normalizeForTrigram(s: string): string { return s.toLowerCase().replace(/\s+/g, ' ').trim(); diff --git a/packages/core/src/embeddings/embedding-provider.ts b/packages/core/src/embeddings/embedding-provider.ts index 86a420b..18bf53a 100644 --- a/packages/core/src/embeddings/embedding-provider.ts +++ b/packages/core/src/embeddings/embedding-provider.ts @@ -109,7 +109,6 @@ function createMockEmbedder(dims: number): Embedder { } // ── Embed-input guards (oversized-frame truncation + skip-not-abort) ── -// Reverse-ported from OSS hive-mind (oss-drift triage R5, 2026-06-11). /** * Per-input character cap for embedding. `nomic-embed-text` has a 2048-token @@ -334,7 +333,6 @@ export async function createEmbeddingProvider(config?: EmbeddingProviderConfig): // most dangerous failure mode in Phase 3b-3 audit. Mock embeddings // are deterministic byte hashes; semantic search returns noise. // We want this to be IMPOSSIBLE to miss in a CLI/server log. - // Ported from hive-mind a99ea0e. const msg = [ '', '⚠️ EMBEDDING WARNING ─────────────────────────────────────────', @@ -381,7 +379,7 @@ export async function createEmbeddingProvider(config?: EmbeddingProviderConfig): async embed(text: string): Promise { // Cap input to the active model's context so the backend never rejects - // an oversized frame. Reverse-ported from OSS hive-mind (oss-drift triage R5, 2026-06-11). + // an oversized frame. const capped = capEmbedText(text, maxEmbedCharsForModel(activeModelName)); try { const result = await activeEmbedder.embed(capped); @@ -399,8 +397,7 @@ export async function createEmbeddingProvider(config?: EmbeddingProviderConfig): async embedBatch(texts: string[]): Promise { if (texts.length === 0) return []; // Cap each input first so one oversized frame can't make the backend - // reject the whole request. Reverse-ported from OSS hive-mind - // (oss-drift triage R5, 2026-06-11). + // reject the whole request. const capped = texts.map(t => capEmbedText(t, maxEmbedCharsForModel(activeModelName))); try { const result = await activeEmbedder.embedBatch(capped); diff --git a/packages/core/src/logger.ts b/packages/core/src/logger.ts index 28cd5f8..713ab4e 100644 --- a/packages/core/src/logger.ts +++ b/packages/core/src/logger.ts @@ -5,7 +5,6 @@ * structured output (pino, winston, etc.) can wrap their logger in this * shape and pass it as a dependency. */ -// Reverse-ported from OSS hive-mind (oss-drift triage R1, 2026-06-11). export interface CoreLogger { info(msg: string, data?: unknown): void; warn(msg: string, data?: unknown): void; @@ -15,16 +14,15 @@ export interface CoreLogger { export function createCoreLogger(tag: string): CoreLogger { const prefix = `[waggle:${tag}]`; - // ALL diagnostics go to stderr. stdout is reserved for program data — the - // MCP stdio protocol (hive-mind-mcp-server) and CLI `--json` envelopes — so + // ALL diagnostics go to stderr. stdout is reserved for program data — MCP + // stdio protocols and CLI `--json` envelopes — so // a library log line on stdout corrupts machine consumers. console.warn and // console.error already target stderr; route info/debug there too rather // than console.info/console.debug (which write to stdout). - // Reverse-ported from OSS hive-mind (oss-drift triage R1, 2026-06-11). // // Guard the optional payload with `data !== undefined` (NOT a truthiness // check) so falsy-but-defined payloads (0, '', false, null) are still - // logged instead of silently dropped. Ported from hive-mind a99ea0e. + // logged instead of silently dropped. return { info: (msg: string, data?: unknown) => data !== undefined ? console.error(`${prefix} ${msg}`, data) : console.error(`${prefix} ${msg}`), diff --git a/packages/core/src/recall/inprocess-reranker.ts b/packages/core/src/recall/inprocess-reranker.ts index d342ba9..c63297d 100644 --- a/packages/core/src/recall/inprocess-reranker.ts +++ b/packages/core/src/recall/inprocess-reranker.ts @@ -53,7 +53,7 @@ export async function createInProcessReranker( config?: Partial, ): Promise { const model = config?.model ?? 'Xenova/ms-marco-MiniLM-L-6-v2'; - const cacheDir = config?.cacheDir ?? path.join(os.homedir(), '.hive-mind', 'models'); + const cacheDir = config?.cacheDir ?? path.join(os.homedir(), '.waggle', 'models'); log.info(`Loading in-process reranker: ${model} (~22MB first download)`); diff --git a/packages/core/src/recall/resolve-relative-date.ts b/packages/core/src/recall/resolve-relative-date.ts index 811d55e..152eea6 100644 --- a/packages/core/src/recall/resolve-relative-date.ts +++ b/packages/core/src/recall/resolve-relative-date.ts @@ -12,7 +12,7 @@ * See benchmarks/results/memori-phase22-RESULT.md (Phase 4). * * This is the deterministic, dependency-free production counterpart of the benchmark's - * LLM extraction pass (hive-mind-test scripts/locomo/33-distill-episodic.mjs). It covers + * LLM extraction pass. It covers * the dominant cue patterns the calibration surfaced ("yesterday", "last week", "N days * ago", "last ", "last year") without a per-frame LLM call. Pure + side-effect * free; the caller decides whether to use the resolved date. diff --git a/packages/core/src/workspace-manager.ts b/packages/core/src/workspace-manager.ts index c6fc29c..4487631 100644 --- a/packages/core/src/workspace-manager.ts +++ b/packages/core/src/workspace-manager.ts @@ -179,7 +179,6 @@ export class WorkspaceManager { * with user-supplied names should still go through `create()` so the * generateId collision logic runs. */ - // Reverse-ported from OSS hive-mind (oss-drift triage R4, 2026-06-11). ensure(id: string, options: Partial = {}): WorkspaceConfig { this.assertWorkspaceId(id); const existing = this.get(id); diff --git a/packages/core/tests/embeddings/embedding-provider.test.ts b/packages/core/tests/embeddings/embedding-provider.test.ts index a654540..303edf0 100644 --- a/packages/core/tests/embeddings/embedding-provider.test.ts +++ b/packages/core/tests/embeddings/embedding-provider.test.ts @@ -1,18 +1,6 @@ /** - * createEmbeddingProvider tests — ported from - * hive-mind/packages/core/src/mind/embedding-provider.test.ts. - * - * Memory Sync Repair Step 2. Source: hive-mind file at HEAD c363257. - * - * Verbatim port — only the import path is adjusted from - * `./embedding-provider.js` to `../../src/mind/embedding-provider.js`. - * - * NOTE: waggle-os has additional `tests/embedding-provider-quota.test.ts` - * at the top level that exercises tier+quota enforcement (Waggle-only - * feature). That file is NOT a substitute for this port — they cover - * complementary surfaces: this file pins the generic mock fallback, - * dimension respect, deterministic-vector behavior, batch shape, and - * reprobe contract; the top-level file pins tier gating. + * createEmbeddingProvider tests: the generic mock fallback, dimension respect, + * deterministic-vector behavior, batch shape and the reprobe contract. */ import { describe, it, expect } from 'vitest'; import { @@ -23,7 +11,7 @@ import { } from '../../src/embeddings/embedding-provider.js'; import type { Embedder } from '../../src/embeddings/embeddings.js'; -describe('createEmbeddingProvider (hive-mind port)', () => { +describe('createEmbeddingProvider', () => { it('falls back to mock when provider=mock is requested explicitly', async () => { const provider = await createEmbeddingProvider({ provider: 'mock' }); expect(provider.getActiveProvider()).toBe('mock'); @@ -97,7 +85,6 @@ describe('createEmbeddingProvider (hive-mind port)', () => { }); }); -// Reverse-ported from OSS hive-mind (oss-drift triage R5, 2026-06-11). describe('embedding guards (oversized-frame truncation + skip-not-abort)', () => { it('capEmbedText truncates only inputs over the limit', () => { expect(capEmbedText('short', 6000)).toBe('short'); diff --git a/packages/core/tests/embeddings/inprocess-embedder.test.ts b/packages/core/tests/embeddings/inprocess-embedder.test.ts index ee4e93b..d13d8c5 100644 --- a/packages/core/tests/embeddings/inprocess-embedder.test.ts +++ b/packages/core/tests/embeddings/inprocess-embedder.test.ts @@ -1,19 +1,11 @@ /** - * In-process embedder tests — ported from - * hive-mind/packages/core/src/mind/inprocess-embedder.test.ts. - * - * Memory Sync Repair Step 2. Source: hive-mind file at HEAD c363257. - * - * Verbatim port — only the import path is adjusted from - * `./inprocess-embedder.js` to `../../src/mind/inprocess-embedder.js` - * to match waggle-os's tests/mind/ placement convention. Both repos - * export the same `normalizeDimensions(input, target)` shape with the - * documented "no-copy fast path when dims match" contract. + * In-process embedder tests: `normalizeDimensions(input, target)` and its + * "no-copy fast path when dims match" contract. */ import { describe, it, expect } from 'vitest'; import { normalizeDimensions } from '../../src/embeddings/inprocess-embedder.js'; -describe('normalizeDimensions (hive-mind port)', () => { +describe('normalizeDimensions', () => { it('returns the same vector when lengths already match', () => { const input = new Float32Array([1, 2, 3, 4]); const output = normalizeDimensions(input, 4); diff --git a/packages/core/tests/logger.test.ts b/packages/core/tests/logger.test.ts index e4b6270..fe6ff68 100644 --- a/packages/core/tests/logger.test.ts +++ b/packages/core/tests/logger.test.ts @@ -1,10 +1,9 @@ /** * Logger stderr-routing tests. * - * Reverse-ported from OSS hive-mind (oss-drift triage R1, 2026-06-11). - * stdout is reserved for program data (MCP stdio transport in - * hive-mind-mcp-server, CLI --json envelopes) — a library log line on - * stdout corrupts machine consumers, so every level must land on stderr. + * stdout is reserved for program data (MCP stdio transports, CLI --json + * envelopes) — a library log line on stdout corrupts machine consumers, so + * every level must land on stderr. */ import { describe, it, expect, vi, afterEach } from 'vitest'; import { createCoreLogger, type CoreLogger } from '../src/logger.js'; diff --git a/packages/core/tests/workspace-manager.test.ts b/packages/core/tests/workspace-manager.test.ts index b137b5f..4249e28 100644 --- a/packages/core/tests/workspace-manager.test.ts +++ b/packages/core/tests/workspace-manager.test.ts @@ -400,7 +400,6 @@ describe('WorkspaceManager', () => { }); }); - // Reverse-ported from OSS hive-mind (oss-drift triage R4, 2026-06-11). describe('ensure', () => { it('rejects a pre-existing workspace junction without writing through it', () => { const outsideDir = fs.mkdtempSync(path.join(os.tmpdir(), 'waggle-ws-outside-')); diff --git a/packages/server/src/local/dream-journal.ts b/packages/server/src/local/dream-journal.ts index 09f35d5..a2892e3 100644 --- a/packages/server/src/local/dream-journal.ts +++ b/packages/server/src/local/dream-journal.ts @@ -9,9 +9,6 @@ * "narrative" polish is layered on top by the /api/dreams route; when the * LLM is unavailable the summary stands. The diary NEVER invents work: every * sentence traces to a recorded counter. - * - * Product layer on purpose — lives in packages/server, not hive-mind-core, - * so it carries no OSS-mirror port obligation (§7.5). */ import fs from 'node:fs'; diff --git a/packages/server/src/local/routes/embedding.ts b/packages/server/src/local/routes/embedding.ts index 51803c7..9ef3102 100644 --- a/packages/server/src/local/routes/embedding.ts +++ b/packages/server/src/local/routes/embedding.ts @@ -10,8 +10,8 @@ * Hot-swap note: the live embedder is created once at boot and threaded BY * REFERENCE into the Orchestrator, mind search, and the vector-backfill path. * There is no runtime seam to replace it in place — the Orchestrator holds the - * embedder and hive-mind-core (which owns the provider factory) is read-only - * from here. So a provider change is PERSISTED to config.json and takes effect + * embedder and the provider factory in @waggle/core is read-only from here. So + * a provider change is PERSISTED to config.json and takes effect * on the next restart. The response carries `restartRequired` so the UI can say * so honestly rather than pretending the switch is live. */ diff --git a/packages/shared/src/risk.ts b/packages/shared/src/risk.ts index 89e9efd..2c1adb4 100644 --- a/packages/shared/src/risk.ts +++ b/packages/shared/src/risk.ts @@ -4,7 +4,7 @@ * Before this module the vocabulary was redeclared in five places that had * drifted apart — trust-model.ts (RiskLevel without 'critical'), confirmation.ts * (a hardcoded ApprovalClass mapper), install-audit.ts (the widest set, plus a - * hand-duplicated SQLite CHECK in hive-mind-core/schema.ts), and + * hand-duplicated SQLite CHECK in the memory schema), and * team-capability-governance.ts (a 4th set keyed on 'none'). A producer narrower * than its store meant a `critical` risk could only ever be hand-written, and the * FE modal couldn't represent the `critical`/`blocked` levels the audit recorded. @@ -95,8 +95,8 @@ export function riskAtLeast(level: RiskLevel, threshold: RiskLevel): boolean { } /** Build a SQLite `CHECK (col IN (...))` clause body from a const value list, so - * the DDL constraint and the TS union can never drift (A3 single-sources both - * install-audit.ts and hive-mind-core/schema.ts from these arrays). */ + * the DDL constraint and the TS union can never drift (install-audit.ts builds + * its CHECK from these arrays). */ export function sqlInList(values: readonly string[]): string { return values.map((v) => `'${v}'`).join(', '); } diff --git a/packages/shared/src/types.ts b/packages/shared/src/types.ts index 4083ef7..d1ee465 100644 --- a/packages/shared/src/types.ts +++ b/packages/shared/src/types.ts @@ -544,7 +544,7 @@ export interface McpInstance { /** * PRD §15.3 workspace contract — the normalized shape the sidecar route layer - * exposes to the new UI. The PERSISTED struct lives in `@waggle/hive-mind-core` + * exposes to the new UI. The PERSISTED struct lives in `@waggle/core` * (`workspace-manager.ts` `WorkspaceConfig`, a superset carrying legacy fields). * A route-layer normalizer (Phase 1) bridges the struct to this contract, filling * defaults for pre-V2 workspaces (type from templateId/group, status 'active', diff --git a/tests/placeholder-audit.test.ts b/tests/placeholder-audit.test.ts index e0a442d..66c996a 100644 --- a/tests/placeholder-audit.test.ts +++ b/tests/placeholder-audit.test.ts @@ -22,13 +22,6 @@ const REPO_ROOT = resolve(__dirname, '..'); * The pinned count from the 2026-04-19 audit. History: * - 2026-05-08: 10 → 0 (DAY0V-01 + DAY0V-02 cleanup; WS gateway TODO removed * + mock-channel-connectors.ts deleted) - * - 2026-05-10: 0 → 6 (Phase 2 consolidation merge of - * feature/hive-mind-monorepo-migration; 6 subtree-split hook packages - * carry intentional `// TODO: Wave 2/3 implementation` STUB markers) - * - 2026-06-01: 6 → 1 (Wave 2/3 hook ports implemented 5 of the 6 stub - * packages — codex / codex-desktop / cursor / hermes / openclaw — removing - * their `// TODO: Wave 2/3 implementation` markers; only the still-deferred - * `hive-mind-hooks-claude-desktop` stub remains) * * Update this when the audit doc is bumped; NEVER bump it without documenting * the new hit in docs/plans/L-17-placeholder-audit-2026-04-19.md.