teleo-infrastructure/docs/reports/leo-working-state-20260709/leo-db-state-21-forgejo-load-agent-loop.svg
twentyOne2x ae00beeb3b
Some checks are pending
CI / lint-and-test (push) Waiting to run
Document Working Leo DB identity provenance
- Map VPS Hermes, Forgejo, SOUL rendering, and document-artifact boundaries.

- Expand Cory-style benchmark for identity render, decision matrix, and source refs.

- Retain live-readback diagrams/reports and focused test coverage.

`docs/reports/leo-working-state-20260709/current-truth-index.md`
`docs/reports/leo-working-state-20260709/leo-db-loading-diagram-20260709T214741Z.mmd`
`docs/reports/leo-working-state-20260709/leo-db-loading-diagram-20260709T214741Z.svg`
`docs/reports/leo-working-state-20260709/leo-db-provenance-report-20260709T214741Z.md`
`docs/reports/leo-working-state-20260709/leo-db-state-21-forgejo-load-agent-loop.svg`
`docs/reports/leo-working-state-20260709/leo-db-state-22-identity-render-matrix-artifacts.svg`
`docs/reports/leo-working-state-20260709/vps-hermes-db-mapping-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-current-state-20260709.md`
`docs/reports/leo-working-state-20260709/working-leo-open-ended-benchmark-spec.json`
`scripts/working_leo_open_ended_benchmark.py`
`tests/test_working_leo_open_ended_benchmark.py`
2026-07-09 23:59:42 +02:00

101 lines
10 KiB
XML

<svg xmlns="http://www.w3.org/2000/svg" width="1440" height="920" viewBox="0 0 1440 920" role="img" aria-labelledby="title desc">
<title id="title">Current Leo DB provenance, loading, and agent update loop</title>
<desc id="desc">Diagram explaining confirmed current state: Forgejo is code and pipeline provenance, Docker Postgres is the canonical KB database, staged proposals are reviewed and applied into public tables, and Leo updates its knowledge by proposing and reading DB rows rather than editing itself directly.</desc>
<defs>
<marker id="arrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth">
<path d="M0,0 L0,6 L9,3 z" fill="#334155"/>
</marker>
<marker id="softarrow" markerWidth="10" markerHeight="10" refX="8" refY="3" orient="auto" markerUnits="strokeWidth">
<path d="M0,0 L0,6 L9,3 z" fill="#64748b"/>
</marker>
</defs>
<rect width="1440" height="920" fill="#f8fafc"/>
<text x="56" y="64" font-family="Arial, sans-serif" font-size="34" font-weight="700" fill="#0f172a">Leo DB provenance, loading, and self-update loop</text>
<text x="56" y="102" font-family="Arial, sans-serif" font-size="18" fill="#334155">Current evidence: Forgejo/repo pipeline moves code and archived source metadata; the live KB authority is Docker Postgres on the VPS.</text>
<rect x="56" y="124" width="1328" height="52" rx="8" fill="#e0f2fe" stroke="#38bdf8" stroke-width="1.5"/>
<text x="78" y="156" font-family="Arial, sans-serif" font-size="18" font-weight="700" fill="#075985">Canonical DB location:</text>
<text x="268" y="156" font-family="Arial, sans-serif" font-size="18" fill="#075985">VPS 77.42.65.182 -> Docker container teleo-pg -> Postgres database teleo -> schemas public and kb_stage</text>
<rect x="56" y="218" width="292" height="178" rx="8" fill="#ffffff" stroke="#475569" stroke-width="2"/>
<text x="82" y="255" font-family="Arial, sans-serif" font-size="24" font-weight="700" fill="#1e293b">Forgejo / repo</text>
<text x="82" y="288" font-family="Arial, sans-serif" font-size="16" fill="#334155">Confirmed role</text>
<text x="104" y="318" font-family="Arial, sans-serif" font-size="15" fill="#475569">- code hosting and old PR pipeline</text>
<text x="104" y="344" font-family="Arial, sans-serif" font-size="15" fill="#475569">- archived source file links</text>
<text x="104" y="370" font-family="Arial, sans-serif" font-size="15" fill="#475569">- deploy provenance inputs</text>
<rect x="56" y="450" width="292" height="136" rx="8" fill="#fff7ed" stroke="#f97316" stroke-width="2"/>
<text x="82" y="486" font-family="Arial, sans-serif" font-size="22" font-weight="700" fill="#9a3412">Initial DB origin</text>
<text x="82" y="519" font-family="Arial, sans-serif" font-size="15" fill="#9a3412">Open question: a one-time seed/import</text>
<text x="82" y="544" font-family="Arial, sans-serif" font-size="15" fill="#9a3412">from Forgejo-managed files may exist,</text>
<text x="82" y="569" font-family="Arial, sans-serif" font-size="15" fill="#9a3412">but current evidence does not prove it.</text>
<rect x="412" y="214" width="292" height="386" rx="8" fill="#ffffff" stroke="#2563eb" stroke-width="3"/>
<text x="438" y="252" font-family="Arial, sans-serif" font-size="24" font-weight="700" fill="#1d4ed8">Load paths</text>
<text x="438" y="286" font-family="Arial, sans-serif" font-size="16" fill="#334155">How data gets into the KB</text>
<rect x="438" y="308" width="240" height="82" rx="6" fill="#eff6ff" stroke="#93c5fd"/>
<text x="458" y="340" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#1e3a8a">1. Files / chat / sources</text>
<text x="458" y="366" font-family="Arial, sans-serif" font-size="15" fill="#1e3a8a">converted into proposals or packets</text>
<rect x="438" y="414" width="240" height="82" rx="6" fill="#eff6ff" stroke="#93c5fd"/>
<text x="458" y="446" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#1e3a8a">2. Approval boundary</text>
<text x="458" y="472" font-family="Arial, sans-serif" font-size="15" fill="#1e3a8a">proposal status, review, exact SQL</text>
<rect x="438" y="520" width="240" height="54" rx="6" fill="#dbeafe" stroke="#60a5fa"/>
<text x="458" y="553" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#1e3a8a">3. Guarded apply into Postgres</text>
<rect x="768" y="214" width="312" height="386" rx="8" fill="#ffffff" stroke="#059669" stroke-width="3"/>
<text x="794" y="252" font-family="Arial, sans-serif" font-size="24" font-weight="700" fill="#047857">Canonical Postgres</text>
<text x="794" y="286" font-family="Arial, sans-serif" font-size="16" fill="#334155">teleo.public is the applied KB</text>
<rect x="794" y="308" width="260" height="164" rx="6" fill="#ecfdf5" stroke="#86efac"/>
<text x="816" y="340" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#064e3b">public.claims</text>
<text x="816" y="366" font-family="Arial, sans-serif" font-size="15" fill="#064e3b">canonical concise claim rows</text>
<text x="816" y="394" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#064e3b">public.sources</text>
<text x="816" y="420" font-family="Arial, sans-serif" font-size="15" fill="#064e3b">source excerpts, URLs, hashes</text>
<text x="816" y="448" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#064e3b">public.claim_evidence / edges</text>
<rect x="794" y="502" width="260" height="72" rx="6" fill="#d1fae5" stroke="#34d399"/>
<text x="816" y="533" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#064e3b">strategy_nodes / anchors</text>
<text x="816" y="558" font-family="Arial, sans-serif" font-size="15" fill="#064e3b">agent strategy and telos graph links</text>
<rect x="1136" y="214" width="248" height="386" rx="8" fill="#ffffff" stroke="#b45309" stroke-width="3"/>
<text x="1160" y="252" font-family="Arial, sans-serif" font-size="24" font-weight="700" fill="#92400e">Staging</text>
<text x="1160" y="286" font-family="Arial, sans-serif" font-size="16" fill="#334155">kb_stage is not applied truth</text>
<rect x="1160" y="308" width="198" height="98" rx="6" fill="#fffbeb" stroke="#fbbf24"/>
<text x="1178" y="340" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#78350f">kb_proposals</text>
<text x="1178" y="366" font-family="Arial, sans-serif" font-size="15" fill="#78350f">pending / approved / applied</text>
<text x="1178" y="391" font-family="Arial, sans-serif" font-size="15" fill="#78350f">payload and review metadata</text>
<rect x="1160" y="438" width="198" height="98" rx="6" fill="#fef3c7" stroke="#fbbf24"/>
<text x="1178" y="470" font-family="Arial, sans-serif" font-size="15" font-weight="700" fill="#78350f">staged_claims</text>
<text x="1178" y="496" font-family="Arial, sans-serif" font-size="15" fill="#78350f">body and raw frontmatter</text>
<text x="1178" y="521" font-family="Arial, sans-serif" font-size="15" fill="#78350f">warnings and source refs</text>
<rect x="412" y="664" width="968" height="150" rx="8" fill="#ffffff" stroke="#7c3aed" stroke-width="3"/>
<text x="438" y="703" font-family="Arial, sans-serif" font-size="24" font-weight="700" fill="#5b21b6">How Leo updates itself</text>
<text x="438" y="737" font-family="Arial, sans-serif" font-size="16" fill="#334155">Knowledge and strategy updates are DB lifecycle events, not silent model self-edits.</text>
<text x="462" y="773" font-family="Arial, sans-serif" font-size="15" fill="#4c1d95">1. Leo reads public.* and kb_stage.* to answer with applied/proposed/approved distinctions.</text>
<text x="462" y="799" font-family="Arial, sans-serif" font-size="15" fill="#4c1d95">2. If a chat requests a KB change, Leo stages a proposal or emits a reviewed apply packet.</text>
<text x="462" y="825" font-family="Arial, sans-serif" font-size="15" fill="#4c1d95">3. A guarded human-approved apply writes canonical rows; Leo then re-queries and behaves from the new DB state.</text>
<path d="M348 308 H412" stroke="#334155" stroke-width="3" marker-end="url(#arrow)"/>
<path d="M704 546 H768" stroke="#334155" stroke-width="3" marker-end="url(#arrow)"/>
<path d="M1080 390 H1136" stroke="#64748b" stroke-width="3" marker-end="url(#softarrow)"/>
<path d="M1136 508 C1040 640 850 630 704 546" fill="none" stroke="#64748b" stroke-width="3" stroke-dasharray="8 8" marker-end="url(#softarrow)"/>
<path d="M924 600 V664" stroke="#334155" stroke-width="3" marker-end="url(#arrow)"/>
<path d="M1380 739 C1410 739 1410 390 1358 390" fill="none" stroke="#64748b" stroke-width="3" stroke-dasharray="7 7" marker-end="url(#softarrow)"/>
<path d="M348 518 C374 518 382 518 412 518" fill="none" stroke="#f97316" stroke-width="3" stroke-dasharray="8 8" marker-end="url(#softarrow)"/>
<text x="365" y="290" font-family="Arial, sans-serif" font-size="14" fill="#334155">deploy/code path</text>
<text x="708" y="530" font-family="Arial, sans-serif" font-size="14" fill="#334155">apply</text>
<text x="1090" y="374" font-family="Arial, sans-serif" font-size="14" fill="#64748b">read/status</text>
<text x="940" y="642" font-family="Arial, sans-serif" font-size="14" fill="#334155">answer from DB</text>
<text x="365" y="497" font-family="Arial, sans-serif" font-size="14" fill="#c2410c">unproven seed/import</text>
<rect x="56" y="654" width="292" height="160" rx="8" fill="#f1f5f9" stroke="#94a3b8" stroke-width="2"/>
<text x="82" y="690" font-family="Arial, sans-serif" font-size="21" font-weight="700" fill="#334155">Working interpretation</text>
<text x="82" y="724" font-family="Arial, sans-serif" font-size="15" fill="#475569">Forgejo can explain code provenance</text>
<text x="82" y="749" font-family="Arial, sans-serif" font-size="15" fill="#475569">and maybe historical bootstrap.</text>
<text x="82" y="780" font-family="Arial, sans-serif" font-size="15" fill="#475569">It is not the current canonical</text>
<text x="82" y="805" font-family="Arial, sans-serif" font-size="15" fill="#475569">claim/evidence/source database.</text>
<rect x="210" y="858" width="1020" height="38" rx="8" fill="#0f172a"/>
<text x="252" y="883" font-family="Arial, sans-serif" font-size="17" fill="#ffffff">Safe agent update loop: read DB -> stage proposal -> approval/apply packet -> canonical Postgres rows -> Leo re-reads new truth.</text>
</svg>