feat(synthesize): honest draft notes + idempotent fingerprints; G4 LLM atomize + G5 hybrid verify
C2 status:draft/verified:false. U2/U3 content-fingerprint naming + skip-existing. G4: --deep atomizes one cluster into focused atoms via shared codex bridge (default off -> local template). G5: verification_status verified/assumed/unknown — local structural gate by default, --deep adds HEAD+codex web cross-check. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 4.8
parent
dc909f4bc5
commit
cc751dd6eb
@@ -1,6 +1,9 @@
|
||||
#!/usr/bin/env node
|
||||
import { promises as fs } from 'node:fs'
|
||||
import path from 'node:path'
|
||||
import crypto from 'node:crypto'
|
||||
import { codexAvailable, codexJson } from './mnemazine-codex.mjs'
|
||||
import { verifyLocal, verifyDeep } from './mnemazine-verify.mjs'
|
||||
|
||||
const ROOT = process.env.MNEMAZINE_ROOT || path.resolve(process.cwd())
|
||||
const argv = process.argv.slice(2)
|
||||
@@ -15,6 +18,11 @@ const VAULT = path.resolve(arg('vault', process.env.MNEMAZINE_VAULT || path.join
|
||||
const EXTRACTS = path.resolve(arg('extracts', process.env.MNEMAZINE_EXTRACTS || path.join(ROOT, '.mnemazine/cache/extracted')))
|
||||
const SESSION = arg('session', new Date().toISOString().slice(0, 10))
|
||||
const MIN_CLUSTER_CHARS = Number(arg('min-cluster-chars', '80'))
|
||||
// --deep / --atomize: LLM-split one cluster into many focused atoms (README:50).
|
||||
// Default off — the conservative path (release demo, run.mjs) stays local-only
|
||||
// and never needs codex. Flag also honoured via MNEMAZINE_DEEP=1.
|
||||
const DEEP = argv.includes('--deep') || argv.includes('--atomize') || process.env.MNEMAZINE_DEEP === '1'
|
||||
const MAX_ATOMS = Number(arg('max-atoms', process.env.MNEMAZINE_MAX_ATOMS || '20'))
|
||||
|
||||
const sourceHints = [
|
||||
{ re: /mcp|model context protocol|filesystem mcp|memory mcp|zapier/i, name: 'Model Context Protocol docs', url: 'https://modelcontextprotocol.io/docs/getting-started/intro' },
|
||||
@@ -120,6 +128,16 @@ function uniq(values) {
|
||||
return [...new Set(values.filter(Boolean))]
|
||||
}
|
||||
|
||||
// Content fingerprint = stable hash of a cluster's sorted source refs. Same
|
||||
// inputs -> same fingerprint -> same filename, so re-runs are idempotent and
|
||||
// exact-duplicate clusters are not rewritten (see write loop skip).
|
||||
// ponytail: exact-dup only via source-ref hash; near-duplicate (paraphrase)
|
||||
// dedup needs embeddings — wire fastembed/Ollama here if dup clusters appear.
|
||||
function fingerprint(cluster) {
|
||||
const refs = cluster.records.map(record => String(record.source_ref || '')).sort()
|
||||
return crypto.createHash('sha1').update(refs.join(' | ||||