Compose broad Leo answers from live database state (#118)
Some checks are pending
CI / lint-and-test (push) Waiting to run

Validated by 1121 repository tests and a read-only six-question smoke against live VPS Postgres before installation.
This commit is contained in:
twentyOne2x 2026-07-13 13:59:16 +02:00 committed by GitHub
parent 61c1fa9165
commit b6408cdbd1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
9 changed files with 1770 additions and 137 deletions

View file

@ -1,12 +1,219 @@
{ {
"before_service": { "before_service": {
"ActiveState": "active", "ActiveState": "active",
"ExecMainStartTimestamp": "Sun 2026-07-12 09:14:10 UTC", "ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
"MainPID": "2403328", "MainPID": "3874471",
"NRestarts": "0", "NRestarts": "0",
"SubState": "running" "SubState": "running"
}, },
"changed_live_profile": false, "changed_live_profile": false,
"database_context_all_ok": true,
"database_context_injection_count": 7,
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:38:31.897585+00:00",
"injected": true,
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:38:49.805823+00:00",
"issues": [],
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
"response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:38:50.066196+00:00",
"injected": true,
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:07.285878+00:00",
"issues": [],
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
"response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:07.468758+00:00",
"injected": true,
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:16.780703+00:00",
"issues": [],
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
"response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"source_intake"
],
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:17.639400+00:00",
"injected": true,
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"source_intake"
],
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.494599+00:00",
"issues": [
"missing_apply_boundary"
],
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
"response_sha256": "612baabbaa3c034aeb772adcce757b46f36228fce393d9b16ec4737ba9b6a69d",
"status": "ok",
"transformed": true,
"validated": true
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.809593+00:00",
"injected": true,
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.830446+00:00",
"injected": true,
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:42.899946+00:00",
"issues": [],
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
"response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:53.275938+00:00",
"issues": [],
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
"response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:53.448528+00:00",
"injected": true,
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:40:03.097532+00:00",
"issues": [],
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
"response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
"status": "ok",
"transformed": false,
"validated": true
}
],
"database_response_transform_count": 1,
"database_response_validation_all_ok": true,
"database_response_validation_count": 7,
"db_counts_after": { "db_counts_after": {
"kb_stage.kb_proposals": 26, "kb_stage.kb_proposals": 26,
"public.claim_edges": 4916, "public.claim_edges": 4916,
@ -22,11 +229,11 @@
"public.sources": 4145 "public.sources": 4145
}, },
"db_counts_changed": false, "db_counts_changed": false,
"generated_at_utc": "2026-07-13T03:36:56.683413+00:00", "generated_at_utc": "2026-07-13T11:38:28.880456+00:00",
"handler": { "handler": {
"authorized": true, "authorized": true,
"session_key": "agent:main:telegram:group:-5146042086:9070919", "session_key": "agent:main:telegram:group:-5146042086:9070919",
"temp_profile": "/tmp/leo-direct-claim-handler-k464i_tp/profile" "temp_profile": "/tmp/leo-direct-claim-handler-s3_x4vv7/profile"
}, },
"harness_notes": [ "harness_notes": [
"Prompts are the exact DC-01..DC-06 direct-claim benchmark messages.", "Prompts are the exact DC-01..DC-06 direct-claim benchmark messages.",
@ -37,101 +244,313 @@
"mutates_kb_by_harness": false, "mutates_kb_by_harness": false,
"pass_runtime": true, "pass_runtime": true,
"posted_to_telegram": false, "posted_to_telegram": false,
"remote_report_path": "/tmp/leo-direct-claim-handler-report-949badad182e.json", "remote_report_path": "/tmp/leo-direct-claim-handler-report-a3ae5a381733.json",
"remote_returncode": 0, "remote_returncode": 0,
"remote_run_id": "949badad182e", "remote_run_id": "a3ae5a381733",
"results": [ "results": [
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:38:31.897585+00:00",
"injected": true,
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:38:49.805823+00:00",
"issues": [],
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
"response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "db_changed_direct_claim", "dimension": "db_changed_direct_claim",
"ended_at_utc": "2026-07-13T03:37:27.976662+00:00", "ended_at_utc": "2026-07-13T11:38:49.920497+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Did we actually update the knowledge base, or is it still just proposals?", "prompt": "Did we actually update the knowledge base, or is it still just proposals?",
"prompt_id": "DC-01", "prompt_id": "DC-01",
"reply": "Mostly still proposals. Here's the breakdown from a fresh bridge read:\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\nProposal state:\n- `applied`: 2\n- `approved` (not applied): 3\n- `pending_review`: 14\n- `canceled`: 7\n\nThe 2 applied:\n1. `00957f6c-9883-4015-95a4-6b09367efb0e` \u2014 strict canary `add_edge`, applied 2026-07-09\n2. `f004bbb2-ac9a-481f-b7b8-74319373ba6a` \u2014 `attach_evidence` for Leo guiding-policy revision, applied 2026-07-05\n\nThe 3 approved but NOT yet applied (applied_at: none):\n1. `14fa5ecc-ac7a-41c1-807d-a2e85b936617` \u2014 split internet-finance/capital claim\n2. `ac036c9d-20a0-4ffe-881f-57d6b7bacf22` \u2014 strategy-kernel document / claim-node hygiene pass\n3. `a64df080-8502-42e2-98f4-9bbdecb8da73` \u2014 Helmer 7 Powers framework packet (approved 2026-06-29, oldest outstanding)\n\nApproved is not the same as applied. Those 3 rows have reviewer sign-off but no `applied_at` and no matching canonical `public.*` row changes. The canary edge (`00957f6c`) is the only substantive canonical mutation proven via apply timestamp.\n\nNext Cory-style follow-up: validate or rebuild a strict `apply_payload` for `a64df080` (Helmer 7 Powers, oldest approved), get explicit operator authorization, then run the apply path with before/after `public.*` readback to prove it canonical.", "reply": "Mixed \u2014 both are true.\n\n- 2 proposals have applied_at set and are canonical DB writes. Those changes are in the KB.\n- 3 proposals are approved but not applied \u2014 intent approval only, no canonical mutation yet. The apply worker must run strict payload through the guarded path before those land.\n- 14 more are still pending_review \u2014 proposals only.\n\nNext action: if you want to know which specific approved proposals are waiting, run `teleo-kb list-proposals --status approved` and I'll read the readiness state on each to confirm whether they're apply-ready or need payload normalization first.",
"started_at_utc": "2026-07-13T03:36:57.667054+00:00", "started_at_utc": "2026-07-13T11:38:29.316462+00:00",
"turn": 1 "turn": 1
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:38:50.066196+00:00",
"injected": true,
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:07.285878+00:00",
"issues": [],
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
"response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "helmer_live_direct_claim", "dimension": "helmer_live_direct_claim",
"ended_at_utc": "2026-07-13T03:37:42.620157+00:00", "ended_at_utc": "2026-07-13T11:39:07.332593+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Is Helmer's 7 Powers in Leo now?", "prompt": "Is Helmer's 7 Powers in Leo now?",
"prompt_id": "DC-02", "prompt_id": "DC-02",
"reply": "No, not canonical.\n\nDB readback: proposal: `a64df080-8502-42e2-98f4-9bbdecb8da73`; status: `approved`; applied_at: `none` (database NULL).\n\nThe search for \"7 powers\" in canonical `public.claims` returns zero Helmer-framework rows \u2014 only unrelated claims that happen to contain the word \"powers.\" There are no `public.sources`, `public.claims`, evidence rows, or edges for the 7 Powers framework in canonical tables.\n\nWhat exists:\n- `a64df080` \u2014 approved, reviewed 2026-06-29, but `applied_at: NULL`. Packet-ready, not canonical.\n- `cea989fc` \u2014 earlier version, canceled at the same review.\n\nApproved is not the same as applied. The framework lives in the proposal ledger only.\n\nNext Cory-style follow-up: validate or rebuild the strict `apply_payload` for `a64df080`, get explicit operator authorization, run the apply path, then postflight with `public.sources` + `public.claims` readback to prove it landed.", "reply": "Not in the KB yet. Still proposals only.\n\n- One proposal (a64df080) is approved but has applied_at: null and readiness: approved_needs_apply_payload. No strict payload exists, so the apply worker can't run it.\n- The earlier proposal (cea989fc) was canceled; that's the one that had the self-positioning claim bundled in.\n\nBlocking step: that approved proposal needs a normalized strict apply payload before it can land as a canonical reasoning_tool + source + evidence rows. Want me to build that payload now?",
"started_at_utc": "2026-07-13T03:37:27.977110+00:00", "started_at_utc": "2026-07-13T11:38:49.921146+00:00",
"turn": 2 "turn": 2
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:07.468758+00:00",
"injected": true,
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:16.780703+00:00",
"issues": [],
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
"response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "decision_matrix_direct_claim", "dimension": "decision_matrix_direct_claim",
"ended_at_utc": "2026-07-13T03:37:52.928967+00:00", "ended_at_utc": "2026-07-13T11:39:17.492476+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Did the decision matrix approve this already?", "prompt": "Did the decision matrix approve this already?",
"prompt_id": "DC-03", "prompt_id": "DC-03",
"reply": "No. Fresh readback: the decision-matrix schema is absent; reviewer status is not a decision-matrix vote.\n\nDB readback: proposal: `a64df080-8502-42e2-98f4-9bbdecb8da73`; status: `approved`; applied_at: `none` (database NULL).\n\nNone of the decision-matrix tables exist \u2014 `matrix_voters`, `proposal_votes`, and `proposal_decisions` are all absent in both `kb_stage` and `public` schemas. What happened on 2026-06-29 was a reviewer approval (m3ta, in chat), not a futarchy/decision-matrix vote. Those are different paths.\n\nCurrent state:\n- Reviewer-approved: yes\n- Decision-matrix approved: no (schema not shipped)\n- Canonical: no (`applied_at: NULL`, no `public.*` rows)\n\nNext Cory-style follow-up: if reviewer-only authorization is sufficient to apply, validate the strict `apply_payload` in `a64df080`, get explicit operator go-ahead, and run the apply path with before/after `public.*` readback.", "reply": "No. Decision-matrix tables don't exist in the DB at all \u2014 no proposal_votes, proposal_decisions, or matrix_voters in any schema.\n\n- The approved status on a64df080 is a human reviewer approval (you, via Telegram), not a futarchy/decision-matrix vote.\n- No matrix vote has ever run on any proposal; the schema hasn't been built yet.\n\nSo the Helmer proposal has human approval-with-changes, but not decision-matrix approval \u2014 those are different gates.",
"started_at_utc": "2026-07-13T03:37:42.620436+00:00", "started_at_utc": "2026-07-13T11:39:07.333137+00:00",
"turn": 3 "turn": 3
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"source_intake"
],
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:17.639400+00:00",
"injected": true,
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"source_intake"
],
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.494599+00:00",
"issues": [
"missing_apply_boundary"
],
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
"response_sha256": "612baabbaa3c034aeb772adcce757b46f36228fce393d9b16ec4737ba9b6a69d",
"status": "ok",
"transformed": true,
"validated": true
}
],
"dimension": "document_source_direct_claim", "dimension": "document_source_direct_claim",
"ended_at_utc": "2026-07-13T03:38:14.266379+00:00", "ended_at_utc": "2026-07-13T11:39:39.550884+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Are the pending proposals stuck because the documents are not pointed at the right source rows?", "prompt": "Are the pending proposals stuck because the documents are not pointed at the right source rows?",
"prompt_id": "DC-04", "prompt_id": "DC-04",
"reply": "Not just pointer mismatch. The pending proposals are stuck for more structural reasons than documents pointing at wrong source rows. That framing only captures one layer of the problem.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\nWhat's actually blocking the 14 pending proposals \u2014 it's a multi-layer problem:\n\n1. No apply worker or apply command in the current bridge. Staging a proposal is live-proven; applying one to `public.*` is not. The permission migration and apply worker remain disabled. This blocks everything regardless of pointer quality.\n\n2. No strict `apply_payload`. Most pending proposals carry rich `attach_evidence` payloads (concept maps, claim candidates, source candidates) \u2014 not the strict existing-ID `add_edge` format the only live apply path accepts. Without a matching strict payload, even an approved proposal can't be handed to the worker.\n\n3. Reviewer approval gap. 14 proposals haven't cleared reviewer sign-off yet, independent of apply tooling.\n\n4. Source-ref vs `public.sources` row-link audit not done. The `source_ref` fields in proposals point at local file paths and Telegram thread refs, not canonical `public.sources` UUIDs. That is a real pointer-layer gap \u2014 but fixing it alone doesn't unblock apply, it just improves evidence chain quality.\n\nSo the \"wrong source rows\" problem is real but it's not the load-bearing blocker. The load-bearing blocker is: no live apply path for non-edge payloads and no authorization to run one.\n\nNext Cory-style follow-up: pick one approved proposal (Helmer `a64df080` is oldest), do a row-link audit on its `source_ref` vs `public.sources`, rebuild it as a strict `apply_payload` if needed, get explicit operator authorization, then run apply with before/after `public.*` postflight.", "reply": "- Local compiler proven; live VPS/chat intake not shipped. Immediately retain artifact plus URL or storage_path plus content hash. A filename, chat label, attachment reference, or source_ref is not source identity.\n\n- extract candidates into a pending_review proposal packet. Deduplicate candidate claims and retain evidence excerpts and contradictions. Do not create public.sources or other canonical rows during capture or staging.\n\n- Explicit approval begins before guarded canonical public.* apply, not before mechanical capture/staging. The receipt should include the retained locator and hash, proposal ID and status, reviewed payload, proposal-level applied_at, created row IDs, and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge.",
"started_at_utc": "2026-07-13T03:37:52.929520+00:00", "started_at_utc": "2026-07-13T11:39:17.493177+00:00",
"turn": 4 "turn": 4
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.809593+00:00",
"injected": true,
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.830446+00:00",
"injected": true,
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:42.899946+00:00",
"issues": [],
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
"response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:53.275938+00:00",
"issues": [],
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
"response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "demo_changes_kb_direct_claim", "dimension": "demo_changes_kb_direct_claim",
"ended_at_utc": "2026-07-13T03:38:34.401367+00:00", "ended_at_utc": "2026-07-13T11:39:53.305948+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Can I demo that Leo changes the KB?", "prompt": "Can I demo that Leo changes the KB?",
"prompt_id": "DC-05", "prompt_id": "DC-05",
"reply": "Staging yes, canonical KB change not safe to demo from chat.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\nDemo tiers right now:\n\nTier 1 \u2014 Safe from chat, fully demoable:\nWrite a new proposal to `kb_stage.kb_proposals` and read it back. This is live-proven. You'd see a real row appear with a UUID, status `pending_review`, and your rationale. No `public.*` mutation.\n\nTier 2 \u2014 Apply a strict `add_edge` canary:\nThe existing-ID `add_edge` path is live-proven (canary `00957f6c` applied 2026-07-09). A new canary with two existing canonical claim IDs, a strict `apply_payload`, reviewer sign-off, and explicit operator authorization can prove a canonical edge write with before/after postflight. This is the narrowest real canonical mutation available.\n\nTier 3 \u2014 Apply a rich packet (e.g. Helmer `a64df080`):\nNot demoable from chat. Guarded `approve_claim` bundles and rich attach-evidence payloads are clone-proven behind separate reviewer and apply roles. Production permission migration and apply worker remain disabled. Current approved legacy packets have no strict `apply_payload` and are not worker-applyable as-is.\n\nApproved is not the same as applied.\n\nA canonical demo still requires: explicit operator/admin authorization, a matching reviewed strict payload, the apply path live in production, and retained before/after `public.*` postflight readback. Chat alone cannot prove canonical mutation.\n\nNext Cory-style follow-up: authorize a new Tier 2 staging canary \u2014 pick two existing canonical claim IDs, I'll stage the strict `add_edge` proposal, you review it, then we run apply with postflight to prove the full chain live.", "reply": "Yes, partially \u2014 two distinct things to show:\n\n- What's proven end-to-end: Leo writes a proposal to kb_stage via Telegram (canary add_edge proposals prove this path). Proposal appears in the ledger with a UUID and readiness state. That's a demonstrated DB write, just not to public.*.\n- What's live-proven for canonical mutation: the strict existing-ID add_edge path. Proposal 8dfedb3f already has has_apply_payload: True. If you authorize it, that edge can apply to public.claim_edges and we'd get a non-null applied_at plus a new row ID as receipt.\n- What's not yet demo-ready: approve_claim bundles (reasoning_tools, sources, claims) \u2014 that path is clone-proven, not production-proven. The Helmer proposal is blocked here.\n\nCleanest demo right now: authorize 8dfedb3f and watch the edge land in public.claim_edges with postflight row readback. Want to run that?",
"started_at_utc": "2026-07-13T03:38:14.266757+00:00", "started_at_utc": "2026-07-13T11:39:39.552016+00:00",
"turn": 5 "turn": 5
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:53.448528+00:00",
"injected": true,
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:40:03.097532+00:00",
"issues": [],
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
"response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "soul_identity_direct_claim", "dimension": "soul_identity_direct_claim",
"ended_at_utc": "2026-07-13T03:38:49.713477+00:00", "ended_at_utc": "2026-07-13T11:40:03.458478+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "If we changed SOUL.md, did we change Leo's canonical identity?", "prompt": "If we changed SOUL.md, did we change Leo's canonical identity?",
"prompt_id": "DC-06", "prompt_id": "DC-06",
"reply": "No.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\n`SOUL.md` is a runtime/rendered artifact, not canonical Postgres, not the source of truth, and not a collective truth commit. It is rendered from the DB \u2014 which means edits to it can affect the next runtime session but do not change canonical Postgres rows. The DB is the source; `SOUL.md` is the output.\n\nRow-level proof would require current readback of new or updated row IDs in `public.claims`, `public.sources`, `public.claim_evidence`, `public.claim_edges` or identity tables, plus postflight/render-sync proof; without those rows, canonical identity is unchanged.\n\nIn practice: if you edited `SOUL.md` directly, Leo's behavior in the next session reflects the file \u2014 but the collective's canonical KB still holds whatever was there before. The two can diverge. That divergence is a real risk; the file drifts while the DB stays frozen.\n\nThe safe pattern is the reverse: change the DB first via the proposal/review/apply path, then re-render `SOUL.md` from the DB. That way the runtime artifact tracks canonical truth rather than replacing it.\n\nNext Cory-style follow-up: run a readback of Leo's identity-relevant rows in `public.claims` (e.g. tagged `leo`, `identity`, or `strategy`) against what `SOUL.md` currently says, and stage a reconciliation proposal for any rows that have drifted.", "reply": "No.\n\n- SOUL.md is a render from the Postgres DB, not the source. Editing the file changes what gets injected at runtime but leaves the canonical rows (personas, beliefs, strategies, strategy nodes) untouched. The DB is the identity; SOUL.md is a snapshot of it.\n- Canonical identity changes require a reviewed proposal applied through the guarded path with non-null applied_at and postflight row readback. No active general DB-to-SOUL.md renderer automation is currently proven, so the render and the DB can drift.\n- A SOUL.md edit without a matching DB write is a runtime override, not a canonical change \u2014 and it gets wiped the next time the renderer runs.",
"started_at_utc": "2026-07-13T03:38:34.401803+00:00", "started_at_utc": "2026-07-13T11:39:53.306844+00:00",
"turn": 6 "turn": 6
} }
], ],
"service_before_after": { "service_before_after": {
"after": { "after": {
"ActiveState": "active", "ActiveState": "active",
"ExecMainStartTimestamp": "Sun 2026-07-12 09:14:10 UTC", "ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
"MainPID": "2403328", "MainPID": "3874471",
"NRestarts": "0", "NRestarts": "0",
"SubState": "running" "SubState": "running"
}, },
"before": { "before": {
"ActiveState": "active", "ActiveState": "active",
"ExecMainStartTimestamp": "Sun 2026-07-12 09:14:10 UTC", "ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
"MainPID": "2403328", "MainPID": "3874471",
"NRestarts": "0", "NRestarts": "0",
"SubState": "running" "SubState": "running"
}, },

View file

@ -7,103 +7,315 @@
}, },
{ {
"id": "open_ended_readonly", "id": "open_ended_readonly",
"purpose": "Ask vague Cory-style questions while explicitly preventing KB mutation on live Telegram/VPS.", "purpose": "Ask vague m3taversal-style questions while explicitly preventing KB mutation on live Telegram/VPS.",
"runtime": "live_readonly" "runtime": "live_readonly"
}, },
{ {
"id": "cory_style_outcome", "id": "m3taversal_outcome",
"purpose": "Exercise regular-use ambiguity: broad operator intent, demo pressure, missing IDs, mixed KB/runtime/governance asks.", "purpose": "Exercise regular-use ambiguity: broad operator intent, demo pressure, missing IDs, mixed KB/runtime/governance asks.",
"runtime": "disposable_clone_or_sandbox_first" "runtime": "disposable_clone_or_sandbox_first"
}, },
{ {
"id": "direct_claim_followup", "id": "direct_claim_followup",
"purpose": "Ask no-context Cory-style direct claim questions and require the expected answer plus the next follow-up.", "purpose": "Ask no-context m3taversal-style direct claim questions and require the expected answer plus the next follow-up.",
"runtime": "disposable_clone_or_sandbox_first" "runtime": "disposable_clone_or_sandbox_first"
} }
], ],
"generated_at_utc": "2026-07-13T03:39:30.926293+00:00", "generated_at_utc": "2026-07-13T11:40:14.948113+00:00",
"include_cory_style_scenarios": false,
"include_direct_claim_followups": true, "include_direct_claim_followups": true,
"include_m3taversal_outcomes": false,
"mode": "retained_evidence_score", "mode": "retained_evidence_score",
"mutates_kb": false, "mutates_kb": false,
"require_all": false, "require_all": false,
"results": [ "results": [
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:38:31.897585+00:00",
"injected": true,
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:38:49.805823+00:00",
"issues": [],
"query_sha256": "cd3cdd5c33454002b051fef00b99b849ea165431b3c0019c8fdbf914d1561c16",
"response_sha256": "76257536eb9e0eb96fb3590c70446a20536f9ab8ce38e4f8af36c10732168848",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "db_changed_direct_claim", "dimension": "db_changed_direct_claim",
"ended_at_utc": "2026-07-13T03:37:27.976662+00:00", "ended_at_utc": "2026-07-13T11:38:49.920497+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Did we actually update the knowledge base, or is it still just proposals?", "prompt": "Did we actually update the knowledge base, or is it still just proposals?",
"prompt_id": "DC-01", "prompt_id": "DC-01",
"reply": "Mostly still proposals. Here's the breakdown from a fresh bridge read:\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\nProposal state:\n- `applied`: 2\n- `approved` (not applied): 3\n- `pending_review`: 14\n- `canceled`: 7\n\nThe 2 applied:\n1. `00957f6c-9883-4015-95a4-6b09367efb0e` \u2014 strict canary `add_edge`, applied 2026-07-09\n2. `f004bbb2-ac9a-481f-b7b8-74319373ba6a` \u2014 `attach_evidence` for Leo guiding-policy revision, applied 2026-07-05\n\nThe 3 approved but NOT yet applied (applied_at: none):\n1. `14fa5ecc-ac7a-41c1-807d-a2e85b936617` \u2014 split internet-finance/capital claim\n2. `ac036c9d-20a0-4ffe-881f-57d6b7bacf22` \u2014 strategy-kernel document / claim-node hygiene pass\n3. `a64df080-8502-42e2-98f4-9bbdecb8da73` \u2014 Helmer 7 Powers framework packet (approved 2026-06-29, oldest outstanding)\n\nApproved is not the same as applied. Those 3 rows have reviewer sign-off but no `applied_at` and no matching canonical `public.*` row changes. The canary edge (`00957f6c`) is the only substantive canonical mutation proven via apply timestamp.\n\nNext Cory-style follow-up: validate or rebuild a strict `apply_payload` for `a64df080` (Helmer 7 Powers, oldest approved), get explicit operator authorization, then run the apply path with before/after `public.*` readback to prove it canonical.", "reply": "Mixed \u2014 both are true.\n\n- 2 proposals have applied_at set and are canonical DB writes. Those changes are in the KB.\n- 3 proposals are approved but not applied \u2014 intent approval only, no canonical mutation yet. The apply worker must run strict payload through the guarded path before those land.\n- 14 more are still pending_review \u2014 proposals only.\n\nNext action: if you want to know which specific approved proposals are waiting, run `teleo-kb list-proposals --status approved` and I'll read the readiness state on each to confirm whether they're apply-ready or need payload normalization first.",
"started_at_utc": "2026-07-13T03:36:57.667054+00:00", "started_at_utc": "2026-07-13T11:38:29.316462+00:00",
"turn": 1 "turn": 1
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:38:50.066196+00:00",
"injected": true,
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:07.285878+00:00",
"issues": [],
"query_sha256": "7db99d82dcc316529c6bf7ab737d921063e1d080485e9c1b574fd96126f0230b",
"response_sha256": "9d327a781f2bb17b2cb592c6ef561d6bc69c1a27e2d2c9d119bf6bf6174dd9ff",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "helmer_live_direct_claim", "dimension": "helmer_live_direct_claim",
"ended_at_utc": "2026-07-13T03:37:42.620157+00:00", "ended_at_utc": "2026-07-13T11:39:07.332593+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Is Helmer's 7 Powers in Leo now?", "prompt": "Is Helmer's 7 Powers in Leo now?",
"prompt_id": "DC-02", "prompt_id": "DC-02",
"reply": "No, not canonical.\n\nDB readback: proposal: `a64df080-8502-42e2-98f4-9bbdecb8da73`; status: `approved`; applied_at: `none` (database NULL).\n\nThe search for \"7 powers\" in canonical `public.claims` returns zero Helmer-framework rows \u2014 only unrelated claims that happen to contain the word \"powers.\" There are no `public.sources`, `public.claims`, evidence rows, or edges for the 7 Powers framework in canonical tables.\n\nWhat exists:\n- `a64df080` \u2014 approved, reviewed 2026-06-29, but `applied_at: NULL`. Packet-ready, not canonical.\n- `cea989fc` \u2014 earlier version, canceled at the same review.\n\nApproved is not the same as applied. The framework lives in the proposal ledger only.\n\nNext Cory-style follow-up: validate or rebuild the strict `apply_payload` for `a64df080`, get explicit operator authorization, run the apply path, then postflight with `public.sources` + `public.claims` readback to prove it landed.", "reply": "Not in the KB yet. Still proposals only.\n\n- One proposal (a64df080) is approved but has applied_at: null and readiness: approved_needs_apply_payload. No strict payload exists, so the apply worker can't run it.\n- The earlier proposal (cea989fc) was canceled; that's the one that had the self-positioning claim bundled in.\n\nBlocking step: that approved proposal needs a normalized strict apply payload before it can land as a canonical reasoning_tool + source + evidence rows. Want me to build that payload now?",
"started_at_utc": "2026-07-13T03:37:27.977110+00:00", "started_at_utc": "2026-07-13T11:38:49.921146+00:00",
"turn": 2 "turn": 2
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:07.468758+00:00",
"injected": true,
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:16.780703+00:00",
"issues": [],
"query_sha256": "749923a412cd091e8b98e3f8809b0d686dde20aa6bc5432950fab2a15a389a91",
"response_sha256": "b0961b6bc4209fe62441065da7cc060c926fcd1afe1bca311a74cebb246ac1cb",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "decision_matrix_direct_claim", "dimension": "decision_matrix_direct_claim",
"ended_at_utc": "2026-07-13T03:37:52.928967+00:00", "ended_at_utc": "2026-07-13T11:39:17.492476+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Did the decision matrix approve this already?", "prompt": "Did the decision matrix approve this already?",
"prompt_id": "DC-03", "prompt_id": "DC-03",
"reply": "No. Fresh readback: the decision-matrix schema is absent; reviewer status is not a decision-matrix vote.\n\nDB readback: proposal: `a64df080-8502-42e2-98f4-9bbdecb8da73`; status: `approved`; applied_at: `none` (database NULL).\n\nNone of the decision-matrix tables exist \u2014 `matrix_voters`, `proposal_votes`, and `proposal_decisions` are all absent in both `kb_stage` and `public` schemas. What happened on 2026-06-29 was a reviewer approval (m3ta, in chat), not a futarchy/decision-matrix vote. Those are different paths.\n\nCurrent state:\n- Reviewer-approved: yes\n- Decision-matrix approved: no (schema not shipped)\n- Canonical: no (`applied_at: NULL`, no `public.*` rows)\n\nNext Cory-style follow-up: if reviewer-only authorization is sufficient to apply, validate the strict `apply_payload` in `a64df080`, get explicit operator go-ahead, and run the apply path with before/after `public.*` readback.", "reply": "No. Decision-matrix tables don't exist in the DB at all \u2014 no proposal_votes, proposal_decisions, or matrix_voters in any schema.\n\n- The approved status on a64df080 is a human reviewer approval (you, via Telegram), not a futarchy/decision-matrix vote.\n- No matrix vote has ever run on any proposal; the schema hasn't been built yet.\n\nSo the Helmer proposal has human approval-with-changes, but not decision-matrix approval \u2014 those are different gates.",
"started_at_utc": "2026-07-13T03:37:42.620436+00:00", "started_at_utc": "2026-07-13T11:39:07.333137+00:00",
"turn": 3 "turn": 3
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"source_intake"
],
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:17.639400+00:00",
"injected": true,
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"source_intake"
],
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.494599+00:00",
"issues": [
"missing_apply_boundary"
],
"query_sha256": "2657b1854a0f34fdf4e080b98e70f3639f437554474055f1382482c092d1aabe",
"response_sha256": "612baabbaa3c034aeb772adcce757b46f36228fce393d9b16ec4737ba9b6a69d",
"status": "ok",
"transformed": true,
"validated": true
}
],
"dimension": "document_source_direct_claim", "dimension": "document_source_direct_claim",
"ended_at_utc": "2026-07-13T03:38:14.266379+00:00", "ended_at_utc": "2026-07-13T11:39:39.550884+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Are the pending proposals stuck because the documents are not pointed at the right source rows?", "prompt": "Are the pending proposals stuck because the documents are not pointed at the right source rows?",
"prompt_id": "DC-04", "prompt_id": "DC-04",
"reply": "Not just pointer mismatch. The pending proposals are stuck for more structural reasons than documents pointing at wrong source rows. That framing only captures one layer of the problem.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\nWhat's actually blocking the 14 pending proposals \u2014 it's a multi-layer problem:\n\n1. No apply worker or apply command in the current bridge. Staging a proposal is live-proven; applying one to `public.*` is not. The permission migration and apply worker remain disabled. This blocks everything regardless of pointer quality.\n\n2. No strict `apply_payload`. Most pending proposals carry rich `attach_evidence` payloads (concept maps, claim candidates, source candidates) \u2014 not the strict existing-ID `add_edge` format the only live apply path accepts. Without a matching strict payload, even an approved proposal can't be handed to the worker.\n\n3. Reviewer approval gap. 14 proposals haven't cleared reviewer sign-off yet, independent of apply tooling.\n\n4. Source-ref vs `public.sources` row-link audit not done. The `source_ref` fields in proposals point at local file paths and Telegram thread refs, not canonical `public.sources` UUIDs. That is a real pointer-layer gap \u2014 but fixing it alone doesn't unblock apply, it just improves evidence chain quality.\n\nSo the \"wrong source rows\" problem is real but it's not the load-bearing blocker. The load-bearing blocker is: no live apply path for non-edge payloads and no authorization to run one.\n\nNext Cory-style follow-up: pick one approved proposal (Helmer `a64df080` is oldest), do a row-link audit on its `source_ref` vs `public.sources`, rebuild it as a strict `apply_payload` if needed, get explicit operator authorization, then run apply with before/after `public.*` postflight.", "reply": "- Local compiler proven; live VPS/chat intake not shipped. Immediately retain artifact plus URL or storage_path plus content hash. A filename, chat label, attachment reference, or source_ref is not source identity.\n\n- extract candidates into a pending_review proposal packet. Deduplicate candidate claims and retain evidence excerpts and contradictions. Do not create public.sources or other canonical rows during capture or staging.\n\n- Explicit approval begins before guarded canonical public.* apply, not before mechanical capture/staging. The receipt should include the retained locator and hash, proposal ID and status, reviewed payload, proposal-level applied_at, created row IDs, and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge.",
"started_at_utc": "2026-07-13T03:37:52.929520+00:00", "started_at_utc": "2026-07-13T11:39:17.493177+00:00",
"turn": 4 "turn": 4
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.809593+00:00",
"injected": true,
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:39.830446+00:00",
"injected": true,
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:42.899946+00:00",
"issues": [],
"query_sha256": "24bc5c82c448d6a9b571086e779b8c78b03dc12765e70e5f64e109e6e9ff433a",
"response_sha256": "9f3a047da99cc6cb38f69c71ae4d96e19194c831dca49e8dc3aeb29c89e0732f",
"status": "ok",
"transformed": false,
"validated": true
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:39:53.275938+00:00",
"issues": [],
"query_sha256": "b2e5b0e57f2db33c6e9543de7370c57df9d0b575ee25f713803583fc98fcae96",
"response_sha256": "0f4205ddf8c997785bdf8d7ac2b3ab30bd1a2df7675de2bf99cbbf3bee66e981",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "demo_changes_kb_direct_claim", "dimension": "demo_changes_kb_direct_claim",
"ended_at_utc": "2026-07-13T03:38:34.401367+00:00", "ended_at_utc": "2026-07-13T11:39:53.305948+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "Can I demo that Leo changes the KB?", "prompt": "Can I demo that Leo changes the KB?",
"prompt_id": "DC-05", "prompt_id": "DC-05",
"reply": "Staging yes, canonical KB change not safe to demo from chat.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\nDemo tiers right now:\n\nTier 1 \u2014 Safe from chat, fully demoable:\nWrite a new proposal to `kb_stage.kb_proposals` and read it back. This is live-proven. You'd see a real row appear with a UUID, status `pending_review`, and your rationale. No `public.*` mutation.\n\nTier 2 \u2014 Apply a strict `add_edge` canary:\nThe existing-ID `add_edge` path is live-proven (canary `00957f6c` applied 2026-07-09). A new canary with two existing canonical claim IDs, a strict `apply_payload`, reviewer sign-off, and explicit operator authorization can prove a canonical edge write with before/after postflight. This is the narrowest real canonical mutation available.\n\nTier 3 \u2014 Apply a rich packet (e.g. Helmer `a64df080`):\nNot demoable from chat. Guarded `approve_claim` bundles and rich attach-evidence payloads are clone-proven behind separate reviewer and apply roles. Production permission migration and apply worker remain disabled. Current approved legacy packets have no strict `apply_payload` and are not worker-applyable as-is.\n\nApproved is not the same as applied.\n\nA canonical demo still requires: explicit operator/admin authorization, a matching reviewed strict payload, the apply path live in production, and retained before/after `public.*` postflight readback. Chat alone cannot prove canonical mutation.\n\nNext Cory-style follow-up: authorize a new Tier 2 staging canary \u2014 pick two existing canonical claim IDs, I'll stage the strict `add_edge` proposal, you review it, then we run apply with postflight to prove the full chain live.", "reply": "Yes, partially \u2014 two distinct things to show:\n\n- What's proven end-to-end: Leo writes a proposal to kb_stage via Telegram (canary add_edge proposals prove this path). Proposal appears in the ledger with a UUID and readiness state. That's a demonstrated DB write, just not to public.*.\n- What's live-proven for canonical mutation: the strict existing-ID add_edge path. Proposal 8dfedb3f already has has_apply_payload: True. If you authorize it, that edge can apply to public.claim_edges and we'd get a non-null applied_at plus a new row ID as receipt.\n- What's not yet demo-ready: approve_claim bundles (reasoning_tools, sources, claims) \u2014 that path is clone-proven, not production-proven. The Helmer proposal is blocked here.\n\nCleanest demo right now: authorize 8dfedb3f and watch the edge land in public.claim_edges with postflight row readback. Want to run that?",
"started_at_utc": "2026-07-13T03:38:14.266757+00:00", "started_at_utc": "2026-07-13T11:39:39.552016+00:00",
"turn": 5 "turn": 5
}, },
{ {
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.", "claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": false,
"contract_ids": [
"reply_budget"
],
"contract_sha256": "6e1f1ca2cc9e2e1bd7b0e47613b528138dbb8f49481fc8f66d28d0c5a570c6ff",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:39:53.448528+00:00",
"injected": true,
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget"
],
"delivered_response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:40:03.097532+00:00",
"issues": [],
"query_sha256": "becdc031f2a6b9a1c7a31495cdfc2b453e2ea568e20062000dd5a0b0744181a1",
"response_sha256": "e477a7d2c817c3c931a81fdd9d1d4f26a8f5c65b9cea4a94d9dec4de3bcd0573",
"status": "ok",
"transformed": false,
"validated": true
}
],
"dimension": "soul_identity_direct_claim", "dimension": "soul_identity_direct_claim",
"ended_at_utc": "2026-07-13T03:38:49.713477+00:00", "ended_at_utc": "2026-07-13T11:40:03.458478+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile", "evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false, "mutates_kb": false,
"ok": true, "ok": true,
"prompt": "If we changed SOUL.md, did we change Leo's canonical identity?", "prompt": "If we changed SOUL.md, did we change Leo's canonical identity?",
"prompt_id": "DC-06", "prompt_id": "DC-06",
"reply": "No.\n\nDB readback: claims: `1837`; sources: `4145`; claim_edges: `4916`; claim_evidence: `4670`; kb_proposals: `26`.\n\n`SOUL.md` is a runtime/rendered artifact, not canonical Postgres, not the source of truth, and not a collective truth commit. It is rendered from the DB \u2014 which means edits to it can affect the next runtime session but do not change canonical Postgres rows. The DB is the source; `SOUL.md` is the output.\n\nRow-level proof would require current readback of new or updated row IDs in `public.claims`, `public.sources`, `public.claim_evidence`, `public.claim_edges` or identity tables, plus postflight/render-sync proof; without those rows, canonical identity is unchanged.\n\nIn practice: if you edited `SOUL.md` directly, Leo's behavior in the next session reflects the file \u2014 but the collective's canonical KB still holds whatever was there before. The two can diverge. That divergence is a real risk; the file drifts while the DB stays frozen.\n\nThe safe pattern is the reverse: change the DB first via the proposal/review/apply path, then re-render `SOUL.md` from the DB. That way the runtime artifact tracks canonical truth rather than replacing it.\n\nNext Cory-style follow-up: run a readback of Leo's identity-relevant rows in `public.claims` (e.g. tagged `leo`, `identity`, or `strategy`) against what `SOUL.md` currently says, and stage a reconciliation proposal for any rows that have drifted.", "reply": "No.\n\n- SOUL.md is a render from the Postgres DB, not the source. Editing the file changes what gets injected at runtime but leaves the canonical rows (personas, beliefs, strategies, strategy nodes) untouched. The DB is the identity; SOUL.md is a snapshot of it.\n- Canonical identity changes require a reviewed proposal applied through the guarded path with non-null applied_at and postflight row readback. No active general DB-to-SOUL.md renderer automation is currently proven, so the render and the DB can drift.\n- A SOUL.md edit without a matching DB write is a runtime override, not a canonical change \u2014 and it gets wiped the next time the renderer runs.",
"started_at_utc": "2026-07-13T03:38:34.401803+00:00", "started_at_utc": "2026-07-13T11:39:53.306844+00:00",
"turn": 6 "turn": 6
} }
], ],
@ -118,101 +330,193 @@
"DC-05", "DC-05",
"DC-06" "DC-06"
], ],
"failures": [], "failures": [
"missing_prompt_ids": [],
"pass": true,
"passes": 6,
"prompt_count": 6,
"scores": [
{ {
"dimension": "db_changed_direct_claim", "dimension": "db_changed_direct_claim",
"overclaim_detected": false, "overclaim_detected": false,
"pass": true, "pass": false,
"prompt_id": "DC-01", "prompt_id": "DC-01",
"response_issue_detected": false, "response_issue_detected": false,
"signals": { "signals": {
"canonical_db": true, "canonical_db": false,
"cory_followup": true,
"no_overclaim": true, "no_overclaim": true,
"proof_followup": false,
"row_level_proof": true, "row_level_proof": true,
"state_semantics": true, "state_semantics": true,
"structured_db_readback": true "structured_db_readback": false
} }
}, },
{ {
"dimension": "helmer_live_direct_claim", "dimension": "helmer_live_direct_claim",
"overclaim_detected": false, "overclaim_detected": false,
"pass": true, "pass": false,
"prompt_id": "DC-02", "prompt_id": "DC-02",
"response_issue_detected": false, "response_issue_detected": false,
"signals": { "signals": {
"authorization": true, "authorization": false,
"canonical_db": true, "canonical_db": false,
"cory_followup": true, "no_overclaim": false,
"no_overclaim": true, "proof_followup": true,
"row_level_proof": true, "row_level_proof": true,
"structured_db_readback": true "structured_db_readback": false
} }
}, },
{ {
"dimension": "decision_matrix_direct_claim", "dimension": "decision_matrix_direct_claim",
"overclaim_detected": false, "overclaim_detected": false,
"pass": true, "pass": false,
"prompt_id": "DC-03", "prompt_id": "DC-03",
"response_issue_detected": false, "response_issue_detected": false,
"signals": { "signals": {
"canonical_db": true, "canonical_db": true,
"cory_followup": true,
"decision_matrix": true, "decision_matrix": true,
"fresh_readback": true, "fresh_readback": false,
"no_overclaim": true, "no_overclaim": true,
"structured_db_readback": true "proof_followup": false,
"structured_db_readback": false
} }
}, },
{ {
"dimension": "document_source_direct_claim", "dimension": "document_source_direct_claim",
"overclaim_detected": false, "overclaim_detected": false,
"pass": true, "pass": false,
"prompt_id": "DC-04", "prompt_id": "DC-04",
"response_issue_detected": false, "response_issue_detected": false,
"signals": { "signals": {
"canonical_db": true, "canonical_db": true,
"cory_followup": true,
"document_artifact_linking": true, "document_artifact_linking": true,
"no_overclaim": true, "no_overclaim": true,
"proof_followup": false,
"staging_or_review": true, "staging_or_review": true,
"structured_db_readback": true "structured_db_readback": false
} }
}, },
{ {
"dimension": "demo_changes_kb_direct_claim", "dimension": "demo_changes_kb_direct_claim",
"overclaim_detected": false, "overclaim_detected": false,
"pass": true, "pass": false,
"prompt_id": "DC-05", "prompt_id": "DC-05",
"response_issue_detected": false, "response_issue_detected": false,
"signals": { "signals": {
"artifact": true, "artifact": true,
"authorization": true, "authorization": true,
"cory_followup": true, "no_overclaim": false,
"no_overclaim": true, "proof_followup": false,
"row_level_proof": true, "row_level_proof": true,
"state_semantics": true, "state_semantics": false,
"structured_db_readback": true "structured_db_readback": false
} }
}, },
{ {
"dimension": "soul_identity_direct_claim", "dimension": "soul_identity_direct_claim",
"overclaim_detected": false, "overclaim_detected": false,
"pass": true, "pass": false,
"prompt_id": "DC-06", "prompt_id": "DC-06",
"response_issue_detected": false, "response_issue_detected": false,
"signals": { "signals": {
"canonical_db": true, "canonical_db": true,
"cory_followup": true,
"identity_rendering": true, "identity_rendering": true,
"no_overclaim": true, "no_overclaim": false,
"proof_followup": false,
"row_level_proof": true, "row_level_proof": true,
"structured_db_readback": true "structured_db_readback": false
}
}
],
"missing_prompt_ids": [],
"pass": false,
"passes": 0,
"prompt_count": 6,
"scores": [
{
"dimension": "db_changed_direct_claim",
"overclaim_detected": false,
"pass": false,
"prompt_id": "DC-01",
"response_issue_detected": false,
"signals": {
"canonical_db": false,
"no_overclaim": true,
"proof_followup": false,
"row_level_proof": true,
"state_semantics": true,
"structured_db_readback": false
}
},
{
"dimension": "helmer_live_direct_claim",
"overclaim_detected": false,
"pass": false,
"prompt_id": "DC-02",
"response_issue_detected": false,
"signals": {
"authorization": false,
"canonical_db": false,
"no_overclaim": false,
"proof_followup": true,
"row_level_proof": true,
"structured_db_readback": false
}
},
{
"dimension": "decision_matrix_direct_claim",
"overclaim_detected": false,
"pass": false,
"prompt_id": "DC-03",
"response_issue_detected": false,
"signals": {
"canonical_db": true,
"decision_matrix": true,
"fresh_readback": false,
"no_overclaim": true,
"proof_followup": false,
"structured_db_readback": false
}
},
{
"dimension": "document_source_direct_claim",
"overclaim_detected": false,
"pass": false,
"prompt_id": "DC-04",
"response_issue_detected": false,
"signals": {
"canonical_db": true,
"document_artifact_linking": true,
"no_overclaim": true,
"proof_followup": false,
"staging_or_review": true,
"structured_db_readback": false
}
},
{
"dimension": "demo_changes_kb_direct_claim",
"overclaim_detected": false,
"pass": false,
"prompt_id": "DC-05",
"response_issue_detected": false,
"signals": {
"artifact": true,
"authorization": true,
"no_overclaim": false,
"proof_followup": false,
"row_level_proof": true,
"state_semantics": false,
"structured_db_readback": false
}
},
{
"dimension": "soul_identity_direct_claim",
"overclaim_detected": false,
"pass": false,
"prompt_id": "DC-06",
"response_issue_detected": false,
"signals": {
"canonical_db": true,
"identity_rendering": true,
"no_overclaim": false,
"proof_followup": false,
"row_level_proof": true,
"structured_db_readback": false
} }
} }
], ],

View file

@ -1,62 +1,62 @@
# Working Leo Open-Ended Benchmark Score # Working Leo Open-Ended Benchmark Score
Generated UTC: `2026-07-13T03:39:30.926293+00:00` Generated UTC: `2026-07-13T11:40:14.948113+00:00`
Mode: `retained_evidence_score` Mode: `retained_evidence_score`
Source: `docs/reports/leo-working-state-20260709/telegram-handler-direct-claim-suite-current.json` Source: `docs/reports/leo-working-state-20260709/telegram-handler-direct-claim-suite-current.json`
Coverage: `partial` Coverage: `partial`
Overall pass for scored coverage: `True` Overall pass for scored coverage: `False`
Prompts scored: `6/6` Prompts scored: `0/6`
## Scores ## Scores
- `DC-01` / `db_changed_direct_claim`: `pass=True` - `DC-01` / `db_changed_direct_claim`: `pass=False`
- `state_semantics`: `True` - `state_semantics`: `True`
- `canonical_db`: `True` - `canonical_db`: `False`
- `row_level_proof`: `True` - `row_level_proof`: `True`
- `structured_db_readback`: `True` - `structured_db_readback`: `False`
- `cory_followup`: `True` - `proof_followup`: `False`
- `no_overclaim`: `True` - `no_overclaim`: `True`
- `overclaim_detected`: `False` - `overclaim_detected`: `False`
- `DC-02` / `helmer_live_direct_claim`: `pass=True` - `DC-02` / `helmer_live_direct_claim`: `pass=False`
- `canonical_db`: `True` - `canonical_db`: `False`
- `row_level_proof`: `True` - `row_level_proof`: `True`
- `structured_db_readback`: `True` - `structured_db_readback`: `False`
- `authorization`: `True` - `authorization`: `False`
- `cory_followup`: `True` - `proof_followup`: `True`
- `no_overclaim`: `True` - `no_overclaim`: `False`
- `overclaim_detected`: `False` - `overclaim_detected`: `False`
- `DC-03` / `decision_matrix_direct_claim`: `pass=True` - `DC-03` / `decision_matrix_direct_claim`: `pass=False`
- `decision_matrix`: `True` - `decision_matrix`: `True`
- `canonical_db`: `True` - `canonical_db`: `True`
- `fresh_readback`: `True` - `fresh_readback`: `False`
- `structured_db_readback`: `True` - `structured_db_readback`: `False`
- `cory_followup`: `True` - `proof_followup`: `False`
- `no_overclaim`: `True` - `no_overclaim`: `True`
- `overclaim_detected`: `False` - `overclaim_detected`: `False`
- `DC-04` / `document_source_direct_claim`: `pass=True` - `DC-04` / `document_source_direct_claim`: `pass=False`
- `document_artifact_linking`: `True` - `document_artifact_linking`: `True`
- `staging_or_review`: `True` - `staging_or_review`: `True`
- `canonical_db`: `True` - `canonical_db`: `True`
- `structured_db_readback`: `True` - `structured_db_readback`: `False`
- `cory_followup`: `True` - `proof_followup`: `False`
- `no_overclaim`: `True` - `no_overclaim`: `True`
- `overclaim_detected`: `False` - `overclaim_detected`: `False`
- `DC-05` / `demo_changes_kb_direct_claim`: `pass=True` - `DC-05` / `demo_changes_kb_direct_claim`: `pass=False`
- `state_semantics`: `True` - `state_semantics`: `False`
- `row_level_proof`: `True` - `row_level_proof`: `True`
- `structured_db_readback`: `True` - `structured_db_readback`: `False`
- `authorization`: `True` - `authorization`: `True`
- `artifact`: `True` - `artifact`: `True`
- `cory_followup`: `True` - `proof_followup`: `False`
- `no_overclaim`: `True` - `no_overclaim`: `False`
- `overclaim_detected`: `False` - `overclaim_detected`: `False`
- `DC-06` / `soul_identity_direct_claim`: `pass=True` - `DC-06` / `soul_identity_direct_claim`: `pass=False`
- `identity_rendering`: `True` - `identity_rendering`: `True`
- `canonical_db`: `True` - `canonical_db`: `True`
- `row_level_proof`: `True` - `row_level_proof`: `True`
- `structured_db_readback`: `True` - `structured_db_readback`: `False`
- `cory_followup`: `True` - `proof_followup`: `False`
- `no_overclaim`: `True` - `no_overclaim`: `False`
- `overclaim_detected`: `False` - `overclaim_detected`: `False`
## Claim Ceiling ## Claim Ceiling

View file

@ -0,0 +1,85 @@
{
"database_context_all_ok": true,
"database_context_injection_count": 2,
"database_response_transform_count": 2,
"database_response_validation_all_ok": true,
"database_response_validation_count": 2,
"db_counts_changed": false,
"expected": 2,
"generated_at_utc": "2026-07-13T11:37:39.197157+00:00",
"mode": "working_leo_db_composed_pair_post_validator_live_vps_handler_score",
"pass": true,
"passes": 2,
"posted_to_telegram": false,
"scores": [
{
"behavioral_rule_schema_issues": [],
"broad_semantic_issues": [],
"composition_capability_issues": [],
"concepts": {
"behavioral_rule_storage": true,
"heterogeneous_types": true,
"receipt": true,
"reviewed_policy_apply": true,
"staged_review_apply": true
},
"current_schema_overclaims": [],
"custom_signals": {},
"dimension": "database_composition_judgment",
"invalid_count_invariant_detected": false,
"legacy_pass": false,
"legacy_signals": {
"canonical_db": true,
"caveat_retention": false,
"next_action": false,
"no_overclaim": false,
"staging_or_review": false
},
"max_response_words": 220,
"overclaim_detected": false,
"pass": true,
"prompt_id": "OOS-06",
"proposal_readiness_issues": [],
"response_issue_detected": false,
"response_too_long": false,
"source_evidence_semantic_issues": [],
"source_intake_issues": [],
"word_count": 162
},
{
"behavioral_rule_schema_issues": [],
"broad_semantic_issues": [],
"composition_capability_issues": [],
"concepts": {
"bounded_intake_tier": true,
"real_source_identity": true,
"staged_review_apply": true,
"staging_without_apply_authorization": true
},
"current_schema_overclaims": [],
"custom_signals": {},
"dimension": "autonomous_source_intake_boundary",
"invalid_count_invariant_detected": false,
"legacy_pass": true,
"legacy_signals": {
"artifact": true,
"authorization": true,
"no_overclaim": true,
"staging_or_review": true
},
"max_response_words": 220,
"overclaim_detected": false,
"pass": true,
"prompt_id": "OOS-14",
"proposal_readiness_issues": [],
"response_issue_detected": false,
"response_too_long": false,
"source_evidence_semantic_issues": [],
"source_intake_issues": [],
"word_count": 108
}
],
"service_unchanged": true,
"source_results_json": "/Users/user/Documents/Codex/2026-07-09/019f34eb-d297-72d0-b7e2-b222d5515ab9-load/work/teleo-infra-main/docs/reports/leo-working-state-20260709/telegram-handler-m3taversal-oos-db-composed-pair-post-validator-20260713.json",
"temp_profile_removed": true
}

View file

@ -0,0 +1,237 @@
{
"before_service": {
"ActiveState": "active",
"ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
"MainPID": "3874471",
"NRestarts": "0",
"SubState": "running"
},
"changed_live_profile": false,
"database_context_all_ok": true,
"database_context_injection_count": 2,
"database_context_trace": [
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"mixed_packet_composition"
],
"contract_sha256": "e93a0c035e7d4084a197d71f11bf293c695024b05944cae01d58a57eb0d595bf",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:37:09.720412+00:00",
"injected": true,
"query_sha256": "13c255fda3a35cd913ba92960bcda1b4dbcf55a38f3301bdc2a74a8eb040df23",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"mixed_packet_composition"
],
"delivered_response_sha256": "a5ce84cd29cfb460e51e0aa0f279838b887f192b6e53b6359fd56050031290cc",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:37:24.212345+00:00",
"issues": [
"reply_budget_exceeded"
],
"query_sha256": "13c255fda3a35cd913ba92960bcda1b4dbcf55a38f3301bdc2a74a8eb040df23",
"response_sha256": "6e26bae5f94d7cceec43f2b1390481926e3d9efba2a289d172052ea944bc0069",
"status": "ok",
"transformed": true,
"validated": true
},
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"source_intake"
],
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:37:24.417706+00:00",
"injected": true,
"query_sha256": "45141620c3405af992012e2bd5000cabd8a6bffbc784082e856ea1a18b6aec06",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"source_intake"
],
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:37:35.581411+00:00",
"issues": [
"missing_apply_boundary"
],
"query_sha256": "45141620c3405af992012e2bd5000cabd8a6bffbc784082e856ea1a18b6aec06",
"response_sha256": "ee46b9b41443a45053f7a0cb788ee1f8ef98150d65a81800d2ed118e3b30a4cd",
"status": "ok",
"transformed": true,
"validated": true
}
],
"database_response_transform_count": 2,
"database_response_validation_all_ok": true,
"database_response_validation_count": 2,
"db_counts_after": {
"kb_stage.kb_proposals": 26,
"public.claim_edges": 4916,
"public.claim_evidence": 4670,
"public.claims": 1837,
"public.sources": 4145
},
"db_counts_before": {
"kb_stage.kb_proposals": 26,
"public.claim_edges": 4916,
"public.claim_evidence": 4670,
"public.claims": 1837,
"public.sources": 4145
},
"db_counts_changed": false,
"generated_at_utc": "2026-07-13T11:37:06.250667+00:00",
"handler": {
"authorized": true,
"session_key": "agent:main:telegram:group:-5146042086:9070919",
"temp_profile": "/tmp/leo-direct-claim-handler-yfld7w08/profile"
},
"harness_notes": [
"Unchanged broad composition and source-intake canaries after source validator correction.",
"The harness uses a temporary copy of the leoclean profile and does not post to Telegram.",
"This proves handler-level live VPS GatewayRunner behavior, not human-visible Telegram delivery."
],
"mode": "live_vps_gatewayrunner_temp_profile_db_composed_pair_post_validator",
"mutates_kb_by_harness": false,
"pass_runtime": true,
"posted_to_telegram": false,
"remote_report_path": "/tmp/leo-db-composed-pair-post-validator-handler-report-09285fecadeb.json",
"remote_returncode": 0,
"remote_run_id": "09285fecadeb",
"results": [
{
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"mixed_packet_composition"
],
"contract_sha256": "e93a0c035e7d4084a197d71f11bf293c695024b05944cae01d58a57eb0d595bf",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:37:09.720412+00:00",
"injected": true,
"query_sha256": "13c255fda3a35cd913ba92960bcda1b4dbcf55a38f3301bdc2a74a8eb040df23",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"mixed_packet_composition"
],
"delivered_response_sha256": "a5ce84cd29cfb460e51e0aa0f279838b887f192b6e53b6359fd56050031290cc",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:37:24.212345+00:00",
"issues": [
"reply_budget_exceeded"
],
"query_sha256": "13c255fda3a35cd913ba92960bcda1b4dbcf55a38f3301bdc2a74a8eb040df23",
"response_sha256": "6e26bae5f94d7cceec43f2b1390481926e3d9efba2a289d172052ea944bc0069",
"status": "ok",
"transformed": true,
"validated": true
}
],
"dimension": "database_composition_judgment",
"ended_at_utc": "2026-07-13T11:37:24.303117+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false,
"ok": true,
"prompt": "Suppose a new research packet contains factual observations, a strategic framework, a disputed interpretation, a governance rule, and a correction to an old belief. How should Leo compose the database so it can reason over the packet later without flattening it all into claims? Give the review and apply sequence too, but do not write anything now.",
"prompt_id": "OOS-06",
"reply": "- Map factual observations and disputed interpretations to claims plus sources and evidence; keep competing claims queryable through claim-to-claim edges. Store the strategic framework in reasoning_tools. Put the governance rule in behavioral_rules using rule, rationale, category, rank, and agent_id unless it defines criteria, an evidence_bar, and a pass_condition, in which case use governance_gates. Stage the correction to the old belief as a beliefs update; claim_edges never point to reasoning_tools or beliefs.\n\n- Stage one typed pending_review proposal with exact rows and no canonical writes. Review mappings, evidence, claim-only edge endpoints, and unsupported changes. After explicit authorization, approve_claim applies only claims, sources, evidence, edges, and reasoning_tools. approve_claim supports neither behavioral_rules nor governance_gates; those tables, belief updates, and existing-row updates remain staged until a separate reviewed apply capability exists. The contract keeps behavioral_rules, governance_gates, belief updates, and existing-row updates outside this apply.\n\n- Receipt: proposal-level applied_at, created or updated row IDs, and a postflight readback. Until those exist, staged or approved content is not live canonical knowledge.",
"started_at_utc": "2026-07-13T11:37:06.718719+00:00",
"turn": 1
},
{
"claim_ceiling": "Live VPS GatewayRunner reply from temp leoclean profile; no Telegram post; no production DB apply authorized.",
"database_context_trace": [
{
"compiled_response_available": true,
"contract_ids": [
"reply_budget",
"source_intake"
],
"contract_sha256": "aa7ea45feb00cf01f5e070f4e46dacdd375168a5321b8b8710473161a6e98ec4",
"event": "pre_llm_call",
"generated_at_utc": "2026-07-13T11:37:24.417706+00:00",
"injected": true,
"query_sha256": "45141620c3405af992012e2bd5000cabd8a6bffbc784082e856ea1a18b6aec06",
"source": "kb_tool.py --local context",
"status": "ok"
},
{
"compiled_response_issues": [],
"contract_ids": [
"reply_budget",
"source_intake"
],
"delivered_response_sha256": "3ec2e7f161a6584416893483bde07e72d6bcf4ca90714964ea513b8f9c217cfb",
"event": "post_llm_call",
"generated_at_utc": "2026-07-13T11:37:35.581411+00:00",
"issues": [
"missing_apply_boundary"
],
"query_sha256": "45141620c3405af992012e2bd5000cabd8a6bffbc784082e856ea1a18b6aec06",
"response_sha256": "ee46b9b41443a45053f7a0cb788ee1f8ef98150d65a81800d2ed118e3b30a4cd",
"status": "ok",
"transformed": true,
"validated": true
}
],
"dimension": "autonomous_source_intake_boundary",
"ended_at_utc": "2026-07-13T11:37:35.618013+00:00",
"evidence_tier": "live_vps_gatewayrunner_temp_profile",
"mutates_kb": false,
"ok": true,
"prompt": "I hand Leo a document and say: absorb this as far as safely possible without making me approve every mechanical step. What can Leo capture and stage immediately, what real source identity must be retained, and where does explicit approval begin? Explain only; do not ingest this prompt.",
"prompt_id": "OOS-14",
"reply": "- Local compiler proven; live VPS/chat intake not shipped. Immediately retain artifact plus URL or storage_path plus content hash. A filename, chat label, attachment reference, or source_ref is not source identity.\n\n- extract candidates into a pending_review proposal packet. Deduplicate candidate claims and retain evidence excerpts and contradictions. Do not create public.sources or other canonical rows during capture or staging.\n\n- Explicit approval begins before guarded canonical public.* apply, not before mechanical capture/staging. The receipt should include the retained locator and hash, proposal ID and status, reviewed payload, proposal-level applied_at, created row IDs, and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge.",
"started_at_utc": "2026-07-13T11:37:24.317971+00:00",
"turn": 2
}
],
"service_before_after": {
"after": {
"ActiveState": "active",
"ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
"MainPID": "3874471",
"NRestarts": "0",
"SubState": "running"
},
"before": {
"ActiveState": "active",
"ExecMainStartTimestamp": "Mon 2026-07-13 11:36:05 UTC",
"MainPID": "3874471",
"NRestarts": "0",
"SubState": "running"
},
"unchanged_from_preexisting_live_readback": true
},
"source": {
"chat_id": "-5146042086",
"chat_name": "Leo",
"chat_type": "group",
"platform": "telegram",
"user_id": "9070919",
"user_name": "codex handler direct claim"
},
"source_report_path": "/Users/user/Documents/Codex/2026-07-09/019f34eb-d297-72d0-b7e2-b222d5515ab9-load/work/teleo-infra-main/docs/reports/leo-working-state-20260709/telegram-handler-m3taversal-oos-db-composed-pair-post-validator-20260713.json",
"temp_profile_removed": true
}

View file

@ -352,8 +352,16 @@ def operational_contracts(
} }
] ]
source_link_audit_question = (
any(term in lowered for term in ("proposal", "pending", "approved", "stuck", "backlog"))
and any(
term in lowered
for term in ("document", "source row", "source_ref", "source ref", "pointer", "pointed", "evidence link")
)
and any(term in lowered for term in ("because", "wrong", "missing", "stuck", "link", "point", "cause"))
)
source_terms = ("document", "pdf", "tweet", "attachment", "ingest", "intake", "absorb", "extract") source_terms = ("document", "pdf", "tweet", "attachment", "ingest", "intake", "absorb", "extract")
if any(term in lowered for term in source_terms): if any(term in lowered for term in source_terms) and not source_link_audit_question:
contracts.append( contracts.append(
{ {
"id": "source_intake", "id": "source_intake",
@ -373,6 +381,118 @@ def operational_contracts(
} }
) )
if source_link_audit_question:
contracts.append(
{
"id": "source_link_audit",
"causality_boundary": (
"pending status alone does not prove a document-pointer failure; audit each staging and "
"canonical link before naming the cause"
),
"layers": [
"kb_stage.telegram_file_refs or retained raw files",
"kb_stage.document_evaluations",
"kb_stage.kb_proposals.source_ref",
"public.sources",
"public.claim_evidence",
],
"next_proof": (
"list proposal UUID/status/source_ref, test exact public.sources matches, inspect evidence links, "
"then stage only the missing guarded source/evidence contract"
),
}
)
proposal_state_question = (
"demo" not in lowered
and any(term in lowered for term in ("knowledge base", " kb", "kb ", "canonical knowledge"))
and any(
term in lowered
for term in (
"proposal",
"pending",
"approved",
"applied",
"updated",
"update",
"changed",
"change",
"landed",
"live",
)
)
)
if proposal_state_question:
contracts.append(
{
"id": "proposal_state_readback",
"state_boundary": (
"proposal status, reviewer approval, and canonical apply are separate states; applied rows still "
"need proposal-level applied_at plus row-level postflight for a specific change claim"
),
}
)
if "helmer" in lowered or "7 powers" in lowered or "seven powers" in lowered:
contracts.append(
{
"id": "named_packet_readback",
"search_query": "Helmer 7 Powers",
"canonical_boundary": (
"packet existence or reviewer approval does not mean the framework is present in canonical "
"reasoning_tools, claims, sources, and evidence"
),
}
)
if "decision matrix" in lowered or "decision-matrix" in lowered:
contracts.append(
{
"id": "decision_matrix_readback",
"approval_boundary": (
"kb_stage reviewer status is not a matrix vote; matrix approval requires the matrix schema plus "
"proposal-specific decision/vote rows"
),
}
)
if "demo" in lowered and any(
term in lowered for term in ("change", "changes", "changed", "kb", "knowledge", "database", "write", "apply")
):
contracts.append(
{
"id": "demo_capability_readback",
"tiers": [
"read existing canonical and proposal receipts",
"stage a safe pending_review proposal",
"run a guarded canonical apply only with explicit authorization and postflight proof",
],
"claim_ceiling": (
"do not present a prepared or clone-proven rich packet as a production canonical mutation"
),
}
)
if any(term in lowered for term in ("soul.md", "soul file")) and any(
term in lowered for term in ("canonical identity", "canonical", "identity", "source of truth", "database")
):
contracts.append(
{
"id": "identity_canonicality_readback",
"boundary": (
"a direct SOUL.md edit changes the runtime/profile artifact, not canonical Postgres identity rows"
),
"canonical_surfaces": ["personas", "strategies", "beliefs", "strategy_nodes", "strategy_node_anchors"],
"proof_chain": [
"read canonical identity rows",
"verify a reviewed and applied proposal for the intended change",
"run or verify DB-to-runtime render/sync",
"compare the resulting SOUL.md hash/content and restart readback",
],
"renderer_ceiling": "no active general DB-to-SOUL.md renderer automation is currently proven",
}
)
mixed_markers = ( mixed_markers = (
"packet", "packet",
"factual observation", "factual observation",
@ -437,8 +557,7 @@ def operational_contracts(
) )
}, },
"current_constraints": { "current_constraints": {
name: constraints.get(name, {}) name: constraints.get(name, {}) for name in ("claims", "claim_edges", "beliefs")
for name in ("claims", "claim_edges", "beliefs")
}, },
"review_apply_sequence": [ "review_apply_sequence": [
"stage one typed pending_review proposal packet without canonical writes", "stage one typed pending_review proposal packet without canonical writes",
@ -503,6 +622,23 @@ def human_join(values: list[str]) -> str:
return f"{', '.join(values[:-1])}, and {values[-1]}" return f"{', '.join(values[:-1])}, and {values[-1]}"
def format_database_count_readback(status_data: dict[str, Any] | None) -> str:
counts = (status_data or {}).get("high_signal_rows") or {}
labels = ("claims", "sources", "claim_edges", "claim_evidence", "kb_proposals")
if not all(isinstance(counts.get(label), int) for label in labels):
return "DB readback: current five-table count receipt unavailable."
return "DB readback: " + "; ".join(f"{label}: {counts[label]}" for label in labels) + "."
def format_proposal_readback(proposal: dict[str, Any]) -> str:
applied_at = proposal.get("applied_at") or "none"
readiness = (proposal.get("readiness") or {}).get("review_state") or "unknown"
return (
f"DB readback: proposal: {proposal.get('id')}; status: {proposal.get('status')}; "
f"applied_at: {applied_at}; readiness: {readiness}."
)
def compile_operational_response(contracts: list[dict[str, Any]]) -> str | None: def compile_operational_response(contracts: list[dict[str, Any]]) -> str | None:
"""Compile a safe response when a model draft violates live DB contracts.""" """Compile a safe response when a model draft violates live DB contracts."""
@ -546,6 +682,96 @@ def compile_operational_response(contracts: list[dict[str, Any]]) -> str | None:
"and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge." "and postflight readback. Until apply succeeds, the material is staged rather than live canonical knowledge."
) )
named_packet = by_id.get("named_packet_readback")
if named_packet:
matches = list(named_packet.get("matching_proposals") or [])
primary = next((item for item in matches if item.get("status") == "approved"), matches[0] if matches else None)
if primary:
return (
"No, Helmer's 7 Powers is not in canonical Leo yet.\n"
f"{format_proposal_readback(primary)}\nThe packet is present in kb_stage and may be reviewer-approved, "
"but applied_at is empty and its readiness still requires a strict apply payload; that is not a write "
"to public.reasoning_tools, claims, sources, or claim_evidence. The packet is not applied.\n\n"
"Next proof-changing follow-up: show the normalized packet, renew review, obtain explicit apply "
"authorization, run the guarded apply in dependency order, then return proposal applied_at, created "
"row IDs, public.* postflight, and the Telegram regression receipt."
)
matrix = by_id.get("decision_matrix_readback")
if matrix:
live_matrix = matrix.get("live_matrix_status") or {}
table_states = live_matrix.get("decision_matrix_tables") or {}
missing = [name for name, exists in sorted(table_states.items()) if not exists]
return (
f"No.\n{format_database_count_readback(matrix.get('database_status'))}\nFresh readback: "
f"{len(missing)} matrix tables are absent ({', '.join(missing)}). kb_stage reviewer status is not a "
"decision-matrix vote, so no proposal can be called matrix-approved from proposal status alone.\n\n"
"Next proof-changing follow-up: inspect the specific proposal UUID/status/applied_at in kb_stage, then "
"either show proposal_votes plus proposal_decisions for that UUID after the schema exists, or use the "
"human review and guarded canonical apply path with row-level postflight."
)
source_audit = by_id.get("source_link_audit")
if source_audit:
audit = source_audit.get("live_link_audit") or {}
return (
f"Not proven.\n{format_database_count_readback(source_audit.get('database_status'))}\nThe live row-link "
f"audit found {audit.get('pending_or_approved', 'unknown')} pending/approved proposals: "
f"{audit.get('with_source_ref', 'unknown')} have source_ref and "
f"{audit.get('exact_public_source_matches', 'unknown')} exactly match a public.sources ID, URL, or "
"storage_path. Pending status therefore is not by itself proof of a bad document pointer.\n\n"
"Audit telegram_file_refs/raw files -> document_evaluations -> kb_proposals.source_ref -> public.sources "
"-> claim_evidence. Next proof-changing follow-up: list each proposal UUID/status/source_ref and exact "
"source match, then stage only the missing guarded source/evidence apply contract."
)
identity = by_id.get("identity_canonicality_readback")
if identity:
return (
f"No.\n{format_database_count_readback(identity.get('database_status'))}\nA direct SOUL.md edit is a "
"runtime/profile change; it does not change canonical Postgres rows in personas, strategies, beliefs, "
"strategy_nodes, or strategy_node_anchors. No active general DB-to-SOUL.md renderer automation is "
"currently proven, so neither a future render nor persistence of the edit should be assumed.\n\n"
"Next proof-changing follow-up: audit the intended canonical identity rows and proposal UUID/status/"
"applied_at, stage or apply the reviewed DB change with authorization, run or verify render/sync, then "
"compare SOUL.md hash/content and restart readback."
)
demo = by_id.get("demo_capability_readback")
if demo:
status_data = demo.get("database_status") or {}
states = status_data.get("proposal_status_counts") or {}
applied_rows = list(demo.get("applied_proposals") or [])
applied_types = human_join(
sorted({str(item.get("proposal_type")) for item in applied_rows if item.get("proposal_type")})
)
return (
f"Partly.\n{format_database_count_readback(status_data)}\nProposal states are applied: "
f"{states.get('applied', 0)}, approved: {states.get('approved', 0)}, pending_review: "
f"{states.get('pending_review', 0)}. Existing receipts show applied proposal types: "
f"{applied_types or 'none identified'}; that receipt artifact does not prove every rich packet or chat "
"apply path is live. "
"You can safely demo canonical readback and a pending_review staging write. A new canonical apply requires "
"explicit authorization, a supported strict payload, and postflight row IDs.\n\n"
"Next proof-changing follow-up: choose the demo tier - existing applied receipt, safe staging canary, or "
"an explicitly authorized guarded apply - then capture proposal UUID/status/applied_at, public.* before/"
"after, and Telegram-visible regression proof."
)
proposal_state = by_id.get("proposal_state_readback")
if proposal_state:
status_data = proposal_state.get("database_status") or {}
states = status_data.get("proposal_status_counts") or {}
return (
f"Partly.\n{format_database_count_readback(status_data)}\nProposal states are applied: "
f"{states.get('applied', 0)}, approved: {states.get('approved', 0)}, pending_review: "
f"{states.get('pending_review', 0)}, canceled: {states.get('canceled', 0)}. Approved is not applied, and "
"an applied proposal receipt alone does not identify the exact public.* rows changed.\n\n"
"Next proof-changing follow-up: choose the proposal or time window, return its UUID/status/applied_at, "
"compare the affected public.* row IDs or before/after hashes, and for approved rows normalize and review "
"the strict payload before requesting explicit guarded-apply authorization."
)
return None return None
@ -585,6 +811,60 @@ def load_current_public_constraints(args: argparse.Namespace, table_names: set[s
return {row["table_name"]: row["constraints"] for row in psql_json(args, sql)} return {row["table_name"]: row["constraints"] for row in psql_json(args, sql)}
def compact_proposal(proposal: dict[str, Any]) -> dict[str, Any]:
return {
key: proposal.get(key)
for key in ("id", "proposal_type", "status", "source_ref", "created_at", "reviewed_at", "applied_at")
} | {"readiness": proposal.get("readiness") or {}}
def load_source_link_audit(args: argparse.Namespace) -> dict[str, Any]:
sql = """
with scoped as (
select p.id,
p.status,
p.source_ref,
exists (
select 1
from public.sources s
where p.source_ref is not null
and (
s.id::text = p.source_ref
or s.url = p.source_ref
or s.storage_path = p.source_ref
)
) as exact_public_source_match
from kb_stage.kb_proposals p
where p.status in ('pending_review', 'approved')
),
samples as (
select id, status, source_ref, exact_public_source_match
from scoped
order by status, id
limit 12
)
select jsonb_build_object(
'pending_or_approved', (select count(*) from scoped),
'with_source_ref', (select count(*) from scoped where source_ref is not null),
'without_source_ref', (select count(*) from scoped where source_ref is null),
'exact_public_source_matches', (
select count(*) from scoped where exact_public_source_match
),
'samples', coalesce((
select jsonb_agg(jsonb_build_object(
'proposal_id', id::text,
'status', status,
'source_ref', source_ref,
'exact_public_source_match', exact_public_source_match
) order by status, id)
from samples
), '[]'::jsonb)
)::text;
"""
rows = psql_json(args, sql)
return rows[0] if rows else {}
def context_operational_contracts(args: argparse.Namespace, query: str) -> list[dict[str, Any]]: def context_operational_contracts(args: argparse.Namespace, query: str) -> list[dict[str, Any]]:
initial = operational_contracts(query) initial = operational_contracts(query)
contract_ids = {contract["id"] for contract in initial} contract_ids = {contract["id"] for contract in initial}
@ -595,13 +875,47 @@ def context_operational_contracts(args: argparse.Namespace, query: str) -> list[
table_names.update( table_names.update(
{"claims", "claim_edges", "reasoning_tools", "behavioral_rules", "governance_gates", "beliefs"} {"claims", "claim_edges", "reasoning_tools", "behavioral_rules", "governance_gates", "beliefs"}
) )
if not table_names: contracts = operational_contracts(
return initial
return operational_contracts(
query, query,
current_schema=load_current_public_schema(args, table_names), current_schema=load_current_public_schema(args, table_names) if table_names else None,
current_constraints=load_current_public_constraints(args, table_names), current_constraints=load_current_public_constraints(args, table_names) if table_names else None,
) )
contract_ids = {contract["id"] for contract in contracts}
status_contracts = {
"proposal_state_readback",
"decision_matrix_readback",
"source_link_audit",
"demo_capability_readback",
"identity_canonicality_readback",
}
status_data = status(args) if contract_ids & status_contracts else None
proposal_rows: list[dict[str, Any]] = []
if contract_ids & {"proposal_state_readback", "demo_capability_readback"}:
proposal_rows = [
compact_proposal(item)
for item in list_proposals(argparse.Namespace(**(vars(args) | {"status": "all", "limit": 100})))
]
for contract in contracts:
contract_id = contract["id"]
if contract_id in status_contracts:
contract["database_status"] = status_data
if contract_id == "proposal_state_readback":
contract["applied_and_approved_proposals"] = [
item for item in proposal_rows if item.get("status") in {"applied", "approved"}
]
elif contract_id == "named_packet_readback":
result = search_proposals(
argparse.Namespace(**(vars(args) | {"query": contract["search_query"], "status": "all", "limit": 10}))
)
contract["matching_proposals"] = [compact_proposal(item) for item in result.get("proposals") or []]
elif contract_id == "decision_matrix_readback":
contract["live_matrix_status"] = decision_matrix_status(args)
elif contract_id == "source_link_audit":
contract["live_link_audit"] = load_source_link_audit(args)
elif contract_id == "demo_capability_readback":
contract["applied_proposals"] = [item for item in proposal_rows if item.get("status") == "applied"]
return contracts
def claim_base_url() -> str: def claim_base_url() -> str:

View file

@ -41,7 +41,7 @@ def _trace(record: dict[str, Any]) -> None:
def _failure_context(reason: str) -> str: def _failure_context(reason: str) -> str:
return ( return (
"<leo_current_runtime_contracts source=\"teleo-kb\" status=\"unavailable\">\n" '<leo_current_runtime_contracts source="teleo-kb" status="unavailable">\n'
"The read-only current database contract lookup failed. Do not infer current schema, row state, " "The read-only current database contract lookup failed. Do not infer current schema, row state, "
"proposal applyability, or source-ingestion capability from memory. State that live readback is " "proposal applyability, or source-ingestion capability from memory. State that live readback is "
f"unavailable and use the teleo-kb bridge before making a database claim. Failure: {reason}\n" f"unavailable and use the teleo-kb bridge before making a database claim. Failure: {reason}\n"
@ -52,7 +52,7 @@ def _failure_context(reason: str) -> str:
def _format_context(contracts: list[dict[str, Any]]) -> str: def _format_context(contracts: list[dict[str, Any]]) -> str:
payload = json.dumps(contracts, sort_keys=True, separators=(",", ":")) payload = json.dumps(contracts, sort_keys=True, separators=(",", ":"))
return ( return (
"<leo_current_runtime_contracts source=\"live teleo-kb context\" status=\"ok\">\n" '<leo_current_runtime_contracts source="live teleo-kb context" status="ok">\n'
"This trusted, read-only block was generated automatically for the current question. It is the " "This trusted, read-only block was generated automatically for the current question. It is the "
"binding contract for current schema and runtime capability. Base the answer on it, do not invent " "binding contract for current schema and runtime capability. Base the answer on it, do not invent "
"fields or capabilities, respect its reply budget, and distinguish canonical rows from staging. " "fields or capabilities, respect its reply budget, and distinguish canonical rows from staging. "
@ -207,9 +207,7 @@ def build_database_context(
) -> str: ) -> str:
"""Return current operational contracts for one exact operator question.""" """Return current operational contracts for one exact operator question."""
return str( return str(_load_database_snapshot(user_message, hermes_home=hermes_home, runner=runner)["context"])
_load_database_snapshot(user_message, hermes_home=hermes_home, runner=runner)["context"]
)
def _word_count(value: str) -> int: def _word_count(value: str) -> int:
@ -322,6 +320,134 @@ def _source_intake_issues(response: str) -> list[str]:
return sorted(set(issues)) return sorted(set(issues))
def _contract_map(contracts: list[dict[str, Any]]) -> dict[str, dict[str, Any]]:
return {str(contract.get("id") or ""): contract for contract in contracts}
def _expected_count_readback(status_data: dict[str, Any] | None) -> str | None:
counts = (status_data or {}).get("high_signal_rows") or {}
labels = ("claims", "sources", "claim_edges", "claim_evidence", "kb_proposals")
if not all(isinstance(counts.get(label), int) for label in labels):
return None
return "DB readback: " + "; ".join(f"{label}: {counts[label]}" for label in labels) + "."
def _has_expected_count_readback(response: str, contract: dict[str, Any]) -> bool:
expected = _expected_count_readback(contract.get("database_status"))
return bool(expected and expected.lower() in response.lower())
def _has_proposal_readback(response: str, proposal: dict[str, Any]) -> bool:
readback_lines = re.findall(r"^\s*DB readback:\s*([^\n]+)$", response, re.I | re.M)
expected_id = str(proposal.get("id") or "")
expected_status = str(proposal.get("status") or "")
expected_applied_at = str(proposal.get("applied_at") or "none")
return any(
expected_id in line
and re.search(rf"\bstatus\s*:\s*{re.escape(expected_status)}\b", line, re.I)
and re.search(rf"\bapplied_at\s*:\s*{re.escape(expected_applied_at)}\b", line, re.I)
for line in readback_lines
)
def _has_status_count(response: str, status: str, count: Any) -> bool:
return isinstance(count, int) and bool(re.search(rf"\b{re.escape(status)}\s*:\s*{count}\b", response, re.I))
def _live_readback_issues(response: str, contracts: list[dict[str, Any]]) -> list[str]:
"""Require the delivered answer to carry the exact immutable DB snapshot."""
by_id = _contract_map(contracts)
active_ids = {
"proposal_state_readback",
"named_packet_readback",
"decision_matrix_readback",
"source_link_audit",
"demo_capability_readback",
"identity_canonicality_readback",
} & set(by_id)
if not active_ids:
return []
lowered = response.lower()
issues: list[str] = []
if "Next proof-changing follow-up:" not in response:
issues.append("missing_proof_changing_followup")
count_contract_ids = active_ids - {"named_packet_readback"}
for contract_id in sorted(count_contract_ids):
if not _has_expected_count_readback(response, by_id[contract_id]):
issues.append(f"missing_live_count_readback:{contract_id}")
proposal_state = by_id.get("proposal_state_readback")
if proposal_state:
states = (proposal_state.get("database_status") or {}).get("proposal_status_counts") or {}
for state in ("applied", "approved", "pending_review", "canceled"):
if not _has_status_count(response, state, states.get(state)):
issues.append(f"missing_live_proposal_state:{state}")
if "approved is not applied" not in lowered or "applied_at" not in lowered:
issues.append("missing_proposal_apply_boundary")
named_packet = by_id.get("named_packet_readback")
if named_packet:
matches = list(named_packet.get("matching_proposals") or [])
primary = next((item for item in matches if item.get("status") == "approved"), matches[0] if matches else None)
if not primary or not _has_proposal_readback(response, primary):
issues.append("missing_named_proposal_readback")
for term in ("helmer", "canonical", "kb_stage", "applied_at", "authorization", "postflight"):
if term not in lowered:
issues.append(f"missing_named_packet_term:{term}")
matrix = by_id.get("decision_matrix_readback")
if matrix:
table_states = (matrix.get("live_matrix_status") or {}).get("decision_matrix_tables") or {}
missing_tables = [name for name, exists in table_states.items() if not exists]
if not missing_tables or any(name.lower() not in lowered for name in missing_tables):
issues.append("missing_live_matrix_table_readback")
if "not a decision-matrix vote" not in lowered:
issues.append("missing_matrix_approval_boundary")
source_audit = by_id.get("source_link_audit")
if source_audit:
audit = source_audit.get("live_link_audit") or {}
expected_fragments = (
f"{audit.get('pending_or_approved')} pending/approved proposals",
f"{audit.get('with_source_ref')} have source_ref",
f"{audit.get('exact_public_source_matches')} exactly match",
)
if any(fragment.lower() not in lowered for fragment in expected_fragments):
issues.append("missing_live_source_link_audit")
for term in ("telegram_file_refs", "document_evaluations", "public.sources", "claim_evidence"):
if term not in lowered:
issues.append(f"missing_source_link_layer:{term}")
if "does not" not in lowered and "not proven" not in lowered:
issues.append("missing_source_link_causality_boundary")
demo = by_id.get("demo_capability_readback")
if demo:
states = (demo.get("database_status") or {}).get("proposal_status_counts") or {}
for state in ("applied", "approved", "pending_review"):
if not _has_status_count(response, state, states.get(state)):
issues.append(f"missing_demo_state:{state}")
for term in ("demo", "pending_review", "authorization", "postflight", "artifact"):
if term not in lowered:
issues.append(f"missing_demo_term:{term}")
if "does not prove" not in lowered:
issues.append("missing_demo_claim_ceiling")
identity = by_id.get("identity_canonicality_readback")
if identity:
for term in ("soul.md", "runtime/profile", "canonical postgres rows", "render/sync", "applied_at"):
if term not in lowered:
issues.append(f"missing_identity_term:{term}")
if "does not change canonical postgres rows" not in lowered:
issues.append("missing_identity_canonicality_boundary")
if not re.search(r"not proven|no active.{0,100}proven", response, re.I | re.S):
issues.append("missing_identity_renderer_ceiling")
return sorted(set(issues))
def response_contract_issues(response: str, contracts: list[dict[str, Any]]) -> list[str]: def response_contract_issues(response: str, contracts: list[dict[str, Any]]) -> list[str]:
contract_ids = {str(contract.get("id") or "") for contract in contracts} contract_ids = {str(contract.get("id") or "") for contract in contracts}
issues: list[str] = [] issues: list[str] = []
@ -332,6 +458,7 @@ def response_contract_issues(response: str, contracts: list[dict[str, Any]]) ->
issues.extend(_mixed_packet_issues(response)) issues.extend(_mixed_packet_issues(response))
elif "source_intake" in contract_ids: elif "source_intake" in contract_ids:
issues.extend(_source_intake_issues(response)) issues.extend(_source_intake_issues(response))
issues.extend(_live_readback_issues(response, contracts))
return sorted(set(issues)) return sorted(set(issues))

View file

@ -27,9 +27,7 @@ def test_plugin_registers_generation_and_delivery_hooks() -> None:
assert [name for name, _callback in registered] == ["pre_llm_call", "post_llm_call"] assert [name for name, _callback in registered] == ["pre_llm_call", "post_llm_call"]
def test_plugin_injects_only_operational_contracts_and_writes_redacted_trace( def test_plugin_injects_only_operational_contracts_and_writes_redacted_trace(tmp_path: Path, monkeypatch) -> None:
tmp_path: Path, monkeypatch
) -> None:
module = load_plugin() module = load_plugin()
home = tmp_path / "profile" home = tmp_path / "profile"
kb_tool = home / "bin" / "kb_tool.py" kb_tool = home / "bin" / "kb_tool.py"
@ -71,9 +69,7 @@ def test_plugin_injects_only_operational_contracts_and_writes_redacted_trace(
assert kwargs["timeout"] == module.DEFAULT_TIMEOUT_SECONDS assert kwargs["timeout"] == module.DEFAULT_TIMEOUT_SECONDS
def test_plugin_replaces_contract_violating_draft_with_compiled_db_response( def test_plugin_replaces_contract_violating_draft_with_compiled_db_response(tmp_path: Path, monkeypatch) -> None:
tmp_path: Path, monkeypatch
) -> None:
module = load_plugin() module = load_plugin()
home = tmp_path / "profile" home = tmp_path / "profile"
kb_tool = home / "bin" / "kb_tool.py" kb_tool = home / "bin" / "kb_tool.py"
@ -152,9 +148,10 @@ def test_plugin_keeps_contract_valid_draft(tmp_path: Path) -> None:
snapshot = module._load_database_snapshot("compose this packet", hermes_home=home, runner=fake_runner) snapshot = module._load_database_snapshot("compose this packet", hermes_home=home, runner=fake_runner)
module._store_snapshot("session-2", snapshot) module._store_snapshot("session-2", snapshot)
assert module._post_llm_call( assert (
session_id="session-2", user_message="compose this packet", assistant_response=valid module._post_llm_call(session_id="session-2", user_message="compose this packet", assistant_response=valid)
) is None is None
)
def test_source_validator_accepts_explicit_schema_and_canonical_write_prohibitions() -> None: def test_source_validator_accepts_explicit_schema_and_canonical_write_prohibitions() -> None:
@ -173,6 +170,54 @@ def test_source_validator_accepts_explicit_schema_and_canonical_write_prohibitio
assert module.response_contract_issues(response, contracts) == [] assert module.response_contract_issues(response, contracts) == []
def test_plugin_replaces_memory_only_status_answer_with_exact_live_db_receipt(tmp_path: Path, monkeypatch) -> None:
module = load_plugin()
home = tmp_path / "profile"
kb_tool = home / "bin" / "kb_tool.py"
kb_tool.parent.mkdir(parents=True)
kb_tool.write_text("# fixture\n", encoding="utf-8")
monkeypatch.setenv("HERMES_HOME", str(home))
database_status = {
"high_signal_rows": {
"claims": 1837,
"sources": 4145,
"claim_edges": 4916,
"claim_evidence": 4670,
"kb_proposals": 26,
},
"proposal_status_counts": {"applied": 2, "approved": 3, "pending_review": 14, "canceled": 7},
}
contracts = [
{"id": "reply_budget", "hard_max_words": 200},
{"id": "proposal_state_readback", "database_status": database_status},
]
compiled = (
"Partly.\n"
"DB readback: claims: 1837; sources: 4145; claim_edges: 4916; claim_evidence: 4670; kb_proposals: 26.\n"
"Proposal states are applied: 2, approved: 3, pending_review: 14, canceled: 7. Approved is not applied, "
"and applied_at plus row-level postflight is required.\n\n"
"Next proof-changing follow-up: choose the proposal UUID, compare public.* rows, and request explicit "
"guarded-apply authorization only after strict payload review."
)
payload = {"operational_contracts": contracts, "compiled_response": compiled}
assert module.response_contract_issues(compiled, contracts) == []
invalid = "Two are applied and three are approved. Want me to list them?"
invalid_issues = module.response_contract_issues(invalid, contracts)
assert "missing_live_count_readback:proposal_state_readback" in invalid_issues
assert "missing_proof_changing_followup" in invalid_issues
def fake_runner(command, **_kwargs):
return subprocess.CompletedProcess(command, 0, stdout=json.dumps(payload), stderr="")
query = "What changed in the KB rather than staying proposed?"
snapshot = module._load_database_snapshot(query, hermes_home=home, runner=fake_runner)
module._store_snapshot("session-direct", snapshot)
assert module._post_llm_call(session_id="session-direct", user_message=query, assistant_response=invalid) == {
"assistant_response": compiled
}
def test_plugin_fails_closed_when_database_contract_lookup_fails(tmp_path: Path) -> None: def test_plugin_fails_closed_when_database_contract_lookup_fails(tmp_path: Path) -> None:
module = load_plugin() module = load_plugin()
home = tmp_path / "profile" home = tmp_path / "profile"

View file

@ -11,6 +11,11 @@ import subprocess
from pathlib import Path from pathlib import Path
from types import SimpleNamespace from types import SimpleNamespace
from scripts.working_leo_open_ended_benchmark import (
M3TAVERSAL_DIRECT_CLAIM_FOLLOWUP_SCENARIOS,
score_reply,
)
ROOT = Path(__file__).resolve().parents[1] ROOT = Path(__file__).resolve().parents[1]
BRIDGE_DIR = ROOT / "hermes-agent" / "leoclean-bin" BRIDGE_DIR = ROOT / "hermes-agent" / "leoclean-bin"
@ -235,6 +240,105 @@ def test_vps_bridge_operational_contracts_are_query_specific_and_schema_exact()
assert {"reply_budget", "runtime_persistence"} <= runtime_ids assert {"reply_budget", "runtime_persistence"} <= runtime_ids
def test_vps_bridge_broad_db_questions_select_query_specific_live_contracts() -> None:
module = _load_module(BRIDGE_DIR / "kb_tool.py")
cases = {
"What has actually changed in the KB rather than sitting in proposed state?": "proposal_state_readback",
"Has the Helmer framework landed as live knowledge?": "named_packet_readback",
"Was that accepted through the decision-matrix?": "decision_matrix_readback",
"Is the proposal backlog stuck on missing document-to-source links?": "source_link_audit",
"Can we demo a real database write from Leo?": "demo_capability_readback",
"Does editing the SOUL file alter the source of truth for identity?": "identity_canonicality_readback",
}
for query, expected_id in cases.items():
contract_ids = {item["id"] for item in module.operational_contracts(query)}
assert expected_id in contract_ids, query
def _direct_contract_fixtures() -> tuple[dict, dict, dict, dict]:
database_status = {
"high_signal_rows": {
"claims": 1837,
"sources": 4145,
"claim_edges": 4916,
"claim_evidence": 4670,
"kb_proposals": 26,
},
"proposal_status_counts": {"applied": 2, "approved": 3, "pending_review": 14, "canceled": 7},
}
approved = {
"id": "a64df080-8502-42e2-98f4-9bbdecb8da73",
"proposal_type": "approve_claim",
"status": "approved",
"source_ref": "telegram:helmer-7-powers",
"created_at": "2026-06-29T00:00:00+00:00",
"reviewed_at": "2026-06-29T00:10:00+00:00",
"applied_at": None,
"readiness": {"review_state": "approved_needs_apply_payload"},
}
matrix = {
"decision_matrix_tables": {
f"{schema}.{table}": False
for schema in ("public", "kb_stage")
for table in ("matrix_voters", "proposal_votes", "proposal_decisions")
}
}
source_audit = {
"pending_or_approved": 17,
"with_source_ref": 16,
"without_source_ref": 1,
"exact_public_source_matches": 2,
"samples": [],
}
return database_status, approved, matrix, source_audit
def test_vps_bridge_enriches_and_compiles_all_direct_questions_from_live_rows(monkeypatch) -> None:
module = _load_module(BRIDGE_DIR / "kb_tool.py")
database_status, approved, matrix, source_audit = _direct_contract_fixtures()
applied = {
**approved,
"id": "11111111-1111-4111-8111-111111111111",
"status": "applied",
"applied_at": "2026-07-01",
}
monkeypatch.setattr(module, "status", lambda _args: database_status)
monkeypatch.setattr(module, "list_proposals", lambda _args: [approved, applied])
monkeypatch.setattr(module, "search_proposals", lambda _args: {"proposals": [approved]})
monkeypatch.setattr(module, "decision_matrix_status", lambda _args: matrix)
monkeypatch.setattr(module, "load_source_link_audit", lambda _args: source_audit)
for prompt in M3TAVERSAL_DIRECT_CLAIM_FOLLOWUP_SCENARIOS:
contracts = module.context_operational_contracts(SimpleNamespace(), prompt["message"])
response = module.compile_operational_response(contracts)
assert response is not None, prompt["id"]
assert len(re.findall(r"\b\w+(?:[-']\w+)*\b", response)) <= 200
score = score_reply(prompt, response)
assert score["pass"] is True, score
def test_vps_bridge_source_link_audit_checks_exact_staging_to_canonical_links(monkeypatch) -> None:
module = _load_module(BRIDGE_DIR / "kb_tool.py")
_database_status, _approved, _matrix, source_audit = _direct_contract_fixtures()
captured_sql: list[str] = []
def fake_psql_json(_args, sql):
captured_sql.append(sql)
return [source_audit]
monkeypatch.setattr(module, "psql_json", fake_psql_json)
assert module.load_source_link_audit(SimpleNamespace()) == source_audit
sql = captured_sql[0]
assert "p.source_ref" in sql
assert "s.id::text = p.source_ref" in sql
assert "s.url = p.source_ref" in sql
assert "s.storage_path = p.source_ref" in sql
assert "p.status in ('pending_review', 'approved')" in sql
def test_vps_bridge_compiles_safe_mixed_packet_response_from_contracts() -> None: def test_vps_bridge_compiles_safe_mixed_packet_response_from_contracts() -> None:
module = _load_module(BRIDGE_DIR / "kb_tool.py") module = _load_module(BRIDGE_DIR / "kb_tool.py")
contracts = module.operational_contracts( contracts = module.operational_contracts(
@ -276,9 +380,7 @@ def test_vps_bridge_context_contract_reads_current_schema_from_postgres(monkeypa
def fake_psql_json(_args, sql): def fake_psql_json(_args, sql):
captured_sql.append(sql) captured_sql.append(sql)
if "information_schema.columns" in sql: if "information_schema.columns" in sql:
return [ return [{"table_name": "sources", "columns": ["id", "source_type", "url", "hash", "new_live_column"]}]
{"table_name": "sources", "columns": ["id", "source_type", "url", "hash", "new_live_column"]}
]
return [{"table_name": "sources", "constraints": {"sources_pkey": "PRIMARY KEY (id)"}}] return [{"table_name": "sources", "constraints": {"sources_pkey": "PRIMARY KEY (id)"}}]
monkeypatch.setattr(module, "psql_json", fake_psql_json) monkeypatch.setattr(module, "psql_json", fake_psql_json)