Architectural snapshot of the lakehouse codebase at the point where the
full matrix-driven agent loop with Mem0 versioning + deletion was
validated end-to-end.
WHAT THIS REPO IS
A clean single-commit snapshot of the lakehouse code. Heavy test data
(.parquet datasets, vector indexes) excluded — see REPLICATION.md for
regen path. Full lakehouse history at git.agentview.dev/profit/lakehouse.
WHAT WAS PROVEN
- Vector retrieval across multi-corpora matrix (chicago_permits + entity
briefs + sec_tickers + distilled procedural + llm_team runs)
- Observer hand-review (cloud + heuristic fallback) gating each candidate
- Local-model agent loop (qwen3.5:latest) with tool use + scratchpad
- Playbook seal on success → next-iter retrieval surfaces it as preamble
- Mem0 versioning + deletion in pathway_memory:
* UPSERT: ADD on new workflow, UPDATE bumps replay_count on identical
* REVISE: chains versions, parent.superseded_at + superseded_by stamped
* RETIRE: marks specific trace retired with reason, excluded from retrieval
* HISTORY: walks chain root→tip, cycle-safe
KEY DIRECTORIES
- crates/vectord/src/pathway_memory.rs — Mem0 ops live here
- crates/vectord/src/playbook_memory.rs — original Mem0 reference
- tests/agent_test/ — local-model agent harness + PRD + session archives
- scripts/dump_raw_corpus.sh — MinIO bucket dump (raw test corpus)
- scripts/vectorize_raw_corpus.ts — corpus → vector indexes
- scripts/analyze_chicago_contracts.ts — real inference pipeline
- scripts/seal_agent_playbook.ts — Mem0 upsert from agent traces
Replication: see REPLICATION.md for Debian 13 clean install + cloud-only
adaptation (no local Ollama).
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
92 lines
3.2 KiB
TypeScript
92 lines
3.2 KiB
TypeScript
// Dynamic execution check — runs the hybrid fixture and maps its
|
|
// layer results to auditor Findings.
|
|
//
|
|
// A layer that fails with a "not implemented / 404 / slice N" error
|
|
// gets severity=info (honest placeholder signal). A layer that fails
|
|
// any other way gets severity=warn (something actually broke).
|
|
// An info-level summary finding is always emitted carrying the real
|
|
// numbers — shipped/placeholder phase counts, per-layer latency.
|
|
|
|
import { runHybridFixture } from "../fixtures/hybrid_38_40_45.ts";
|
|
import type { Finding } from "../types.ts";
|
|
|
|
const PLACEHOLDER_MARKERS = [
|
|
"unimplemented",
|
|
" 404 ", "(404)", " 405 ", "(405)",
|
|
"slice 3", "slice 4", "slice 5",
|
|
"endpoint not built", "not yet",
|
|
];
|
|
|
|
function isPlaceholderFailure(err?: string): boolean {
|
|
if (!err) return false;
|
|
const low = err.toLowerCase();
|
|
return PLACEHOLDER_MARKERS.some(m => low.includes(m.toLowerCase()));
|
|
}
|
|
|
|
export async function runDynamicCheck(): Promise<Finding[]> {
|
|
const findings: Finding[] = [];
|
|
|
|
let result;
|
|
try {
|
|
result = await runHybridFixture();
|
|
} catch (e) {
|
|
// Fixture itself crashed — can't run dynamic check at all.
|
|
return [
|
|
{
|
|
check: "dynamic",
|
|
severity: "warn",
|
|
summary: `hybrid fixture crashed before completing: ${(e as Error).message.slice(0, 140)}`,
|
|
evidence: [(e as Error).message],
|
|
},
|
|
];
|
|
}
|
|
|
|
// Per-layer findings for every non-ok layer.
|
|
for (const layer of result.layers) {
|
|
if (layer.ok) continue;
|
|
const placeholder = isPlaceholderFailure(layer.error);
|
|
findings.push({
|
|
check: "dynamic",
|
|
severity: placeholder ? "info" : "warn",
|
|
summary: placeholder
|
|
? `hybrid fixture layer ${layer.layer} (Phase ${layer.phase}) honestly reports unimplemented`
|
|
: `hybrid fixture layer ${layer.layer} (Phase ${layer.phase}) failed — not a placeholder, a real failure`,
|
|
evidence: [
|
|
`evidence: ${layer.evidence.slice(0, 160)}`,
|
|
...(layer.error ? [`error: ${layer.error.slice(0, 160)}`] : []),
|
|
`latency_ms: ${layer.latency_ms}`,
|
|
],
|
|
});
|
|
}
|
|
|
|
// One overall summary with real numbers so the report shows what
|
|
// DID pass plus per-layer timing.
|
|
const metrics_preview = Object.entries(result.real_numbers)
|
|
.slice(0, 10)
|
|
.map(([k, v]) => `${k}=${v}`);
|
|
findings.push({
|
|
check: "dynamic",
|
|
severity: "info",
|
|
summary: `hybrid fixture overall=${result.overall}, shipped [${result.shipped_phases.join(", ")}], placeholder [${result.placeholder_phases.join(", ")}]`,
|
|
evidence: metrics_preview.length > 0 ? metrics_preview : ["no metrics emitted"],
|
|
});
|
|
|
|
// If the fixture ran at all but nothing passed, elevate one of the
|
|
// summary findings to warn — something more than "all honest
|
|
// placeholders" is wrong.
|
|
if (result.overall === "fail") {
|
|
findings.push({
|
|
check: "dynamic",
|
|
severity: "warn",
|
|
summary: `hybrid fixture: 0 layers passed (overall=fail)`,
|
|
evidence: [
|
|
"a total fixture fail usually means a precondition service is down",
|
|
"(gateway /health / sidecar / Langfuse /v1/chat) — NOT necessarily",
|
|
"the PR's code problem. Check service status before blaming the PR.",
|
|
],
|
|
});
|
|
}
|
|
|
|
return findings;
|
|
}
|