Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1920 1080" width="100%" role="img" aria-labelledby="title desc">
<title id="title">Persistence & Secret Plane</title>
<desc id="desc">A two-plane architecture view separating ordinary workflow, execution, context, and team persistence from the credential path in which AuthService caches narrowly, CredentialsDatabase encrypts fields, and credentials.db stores only Fernet tokens plus derivation metadata. Sources: server/core/container.py; server/main.py; server/core/database.py; server/models/database.py; server/services/auth.py; server/core/credentials_database.py; server/core/encryption.py; server/services/plugin/credential.py; server/core/config.py</desc>
<defs>
<marker id="arrow" viewBox="0 0 10 10" refX="9" refY="5" markerWidth="8" markerHeight="8" orient="auto"><path d="M0,0 L10,5 L0,10 z" fill="#e8eaed"/></marker>
<style>
.title { fill:#e8eaed; font:700 30px Geist,system-ui,sans-serif; }
.subtitle { fill:#9aa1ac; font:400 18px Geist,system-ui,sans-serif; }
.group-label { fill:#9aa1ac; font:600 16px 'JetBrains Mono',ui-monospace,monospace; letter-spacing:1.2px; }
.type-label { fill:#9aa1ac; font:600 16px 'JetBrains Mono',ui-monospace,monospace; letter-spacing:.8px; }
.node-label { fill:#e8eaed; font:650 20px Geist,system-ui,sans-serif; }
.node-detail { fill:#9aa1ac; font:400 16px Geist,system-ui,sans-serif; }
.edge-label { fill:#e8eaed; font:500 16px Geist,system-ui,sans-serif; }
.edge-protocol { fill:#9aa1ac; font:500 16px 'JetBrains Mono',ui-monospace,monospace; }
.callout-title { fill:#e8eaed; font:650 18px Geist,system-ui,sans-serif; }
.callout-text { fill:#9aa1ac; font:400 16px Geist,system-ui,sans-serif; }
.legend { fill:#9aa1ac; font:500 16px Geist,system-ui,sans-serif; }
</style>
</defs>
<rect width="1920" height="1080" fill="#0d0f13"/>
<text x="72" y="58" class="title">Persistence & Secret Plane</text>
<text x="72" y="91" class="subtitle">Operational state lives in workflow.db; API keys and OAuth tokens cross a separate encrypted credential boundary</text>
<g data-group-id="state-plane"><rect x="50" y="125" width="750" height="830" rx="18" fill="#15171c" stroke="#ff79c6" stroke-width="2"/><text x="70" y="157" class="group-label">APPLICATION PERSISTENCE · workflow.db</text></g><g data-group-id="secret-plane"><rect x="840" y="125" width="1030" height="830" rx="18" fill="#15171c" stroke="#f1fa8c" stroke-width="2"/><text x="860" y="157" class="group-label">SECRET PLANE · credentials.db</text></g><g data-relationship-id="r-runtime-database"><title>persists operational state</title><path d="M 245.0 340 L 245 400 L 610 400 L 610.0 340" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="314.2" y="385.0" width="221.6" height="30" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="425" y="403" class="edge-label" text-anchor="middle" textLength="203.6" lengthAdjust="spacingAndGlyphs">persists operational state</text></g><g data-relationship-id="r-database-workflow"><title>reads and writes SQLModel rows · via sqlite+aiosqlite</title><path d="M 610.0 340 L 610 450 L 445 450 L 445.0 540" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="399.0" y="426.0" width="252.0" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="525" y="447" class="edge-label" text-anchor="middle" textLength="234.0" lengthAdjust="spacingAndGlyphs">reads and writes SQLModel rows</text><text x="525" y="467" class="edge-protocol" text-anchor="middle">via sqlite+aiosqlite</text></g><g data-relationship-id="r-plugin-auth"><title>requests secret resolution</title><path d="M 995.0 340 L 995 400 L 1295 400 L 1295.0 340" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="1034.2" y="385.0" width="221.6" height="30" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1145" y="403" class="edge-label" text-anchor="middle" textLength="203.6" lengthAdjust="spacingAndGlyphs">requests secret resolution</text></g><g data-relationship-id="r-auth-cache"><title>populates safe cache</title><path d="M 1420 265.0 L 1570 265.0" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 1495.0 265.0 L 1495 157" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="1407.0" y="142.0" width="176.0" height="30" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1495" y="160" class="edge-label" text-anchor="middle" textLength="158.0" lengthAdjust="spacingAndGlyphs">populates safe cache</text></g><g data-relationship-id="r-auth-credentials"><title>save · retrieve · delete</title><path d="M 1295.0 340 L 1330.0 490" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 1335.0 415.0 L 975 469" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="871.8" y="454.0" width="206.39999999999998" height="30" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="975" y="472" class="edge-label" text-anchor="middle" textLength="188.4" lengthAdjust="spacingAndGlyphs">save · retrieve · delete</text></g><g data-relationship-id="r-key-encryption"><title>derives in-memory Fernet key</title><path d="M 995.0 660 L 995.0 750" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="876.6" y="695.0" width="236.79999999999998" height="30" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="995" y="713" class="edge-label" text-anchor="middle" textLength="218.8" lengthAdjust="spacingAndGlyphs">derives in-memory Fernet key</text></g><g data-relationship-id="r-credentials-encryption"><title>calls encrypt / decrypt per field</title><path d="M 1330.0 670 L 1330 700 L 1190 700 L 1190 825 L 1120 825.0" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><rect x="1142.6" y="685.0" width="274.79999999999995" height="30" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1280" y="703" class="edge-label" text-anchor="middle" textLength="256.8" lengthAdjust="spacingAndGlyphs">calls encrypt / decrypt per field</text></g><g data-relationship-id="r-credentials-store"><title>stores ciphertext rows and salt · via SQLite</title><path d="M 1330.0 670 L 1330 690 L 1695 690 L 1695.0 710" fill="none" stroke="#e8eaed" stroke-width="2" marker-end="url(#arrow)"/><path d="M 1515.0 690.0 L 1335 744" fill="none" stroke="#9aa1ac" stroke-width="1" stroke-dasharray="3 4" opacity=".7"/><rect x="1205.2" y="720.0" width="259.6" height="48" rx="7" fill="#15171c" stroke="#2b2f37"/><text x="1335" y="741" class="edge-label" text-anchor="middle" textLength="241.6" lengthAdjust="spacingAndGlyphs">stores ciphertext rows and salt</text><text x="1335" y="761" class="edge-protocol" text-anchor="middle">via SQLite</text></g><g data-component-id="runtime-services"><title>Runtime services</title><rect x="100" y="190" width="290" height="150" rx="12" fill="#1b1e25" stroke="#bd93f9" stroke-width="2"/><rect x="100" y="190" width="290" height="7" rx="4" fill="#bd93f9"/><text x="118" y="216" class="type-label">APPLICATION CALLERS</text><text x="118" y="242" class="node-label">Runtime services</text><text x="118" y="268" class="node-detail" textLength="254.0" lengthAdjust="spacingAndGlyphs">Workflows · nodes · deployments</text><text x="118" y="288" class="node-detail">Context · teams · settings</text></g><g data-component-id="database-service"><title>Database</title><rect x="470" y="190" width="280" height="150" rx="12" fill="#1b1e25" stroke="#ff79c6" stroke-width="2"/><rect x="470" y="190" width="280" height="7" rx="4" fill="#ff79c6"/><text x="488" y="216" class="type-label">PERSISTENCE SERVICE</text><text x="488" y="242" class="node-label">Database</text><text x="488" y="268" class="node-detail">Async SQLModel / SQLite</text><text x="488" y="288" class="node-detail" textLength="244.0" lengthAdjust="spacingAndGlyphs">One operational access surface</text></g><g data-component-id="workflow-db"><title>workflow.db</title><rect x="280" y="540" width="330" height="200" rx="12" fill="#1b1e25" stroke="#ff79c6" stroke-width="2"/><rect x="280" y="540" width="330" height="7" rx="4" fill="#ff79c6"/><text x="298" y="566" class="type-label">SQLITE DATA STORE</text><text x="298" y="592" class="node-label">workflow.db</text><text x="298" y="618" class="node-detail">Workflows · node params · outputs</text><text x="298" y="638" class="node-detail">Executions · context · teams</text><text x="298" y="658" class="node-detail">No encrypted credential tables</text></g><g data-component-id="credential-callers"><title>Plugin credentials</title><rect x="870" y="190" width="250" height="150" rx="12" fill="#1b1e25" stroke="#bd93f9" stroke-width="2"/><rect x="870" y="190" width="250" height="7" rx="4" fill="#bd93f9"/><text x="888" y="216" class="type-label">SECRET CONSUMERS</text><text x="888" y="242" class="node-label">Plugin credentials</text><text x="888" y="268" class="node-detail">Credential.resolve</text><text x="888" y="288" class="node-detail" textLength="214.0" lengthAdjust="spacingAndGlyphs">Connection / provider clients</text></g><g data-component-id="auth-service"><title>AuthService</title><rect x="1170" y="190" width="250" height="150" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="1170" y="190" width="250" height="7" rx="4" fill="#f1fa8c"/><text x="1188" y="216" class="type-label">SECRET FACADE</text><text x="1188" y="242" class="node-label">AuthService</text><text x="1188" y="268" class="node-detail" textLength="214.0" lengthAdjust="spacingAndGlyphs">Only service-level credential route</text><text x="1188" y="288" class="node-detail">Store · resolve · remove</text></g><g data-component-id="credential-caches"><title>Process caches</title><rect x="1570" y="190" width="250" height="150" rx="12" fill="#1b1e25" stroke="#ffb86c" stroke-width="2"/><rect x="1570" y="190" width="250" height="7" rx="4" fill="#ffb86c"/><text x="1588" y="216" class="type-label">BOUNDED SECRET CACHE</text><text x="1588" y="242" class="node-label">Process caches</text><text x="1588" y="268" class="node-detail" textLength="214.0" lengthAdjust="spacingAndGlyphs">API keys + model metadata</text><text x="1588" y="288" class="node-detail" textLength="214.0" lengthAdjust="spacingAndGlyphs">OAuth access/display fields only</text></g><g data-component-id="credentials-database"><title>CredentialsDatabase</title><rect x="1170" y="490" width="320" height="180" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="1170" y="490" width="320" height="7" rx="4" fill="#f1fa8c"/><text x="1188" y="516" class="type-label">ENCRYPTED PERSISTENCE</text><text x="1188" y="542" class="node-label">CredentialsDatabase</text><text x="1188" y="568" class="node-detail">EncryptedAPIKey</text><text x="1188" y="588" class="node-detail">EncryptedOAuthToken</text><text x="1188" y="608" class="node-detail">credentials_metadata</text></g><g data-component-id="encryption-password"><title>API_KEY_ENCRYPTION_KEY</title><rect x="870" y="510" width="250" height="150" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="870" y="510" width="250" height="7" rx="4" fill="#f1fa8c"/><text x="888" y="536" class="type-label">SERVER CONFIGURATION</text><text x="888" y="562" class="node-label">API_KEY_</text><text x="888" y="584" class="node-label">ENCRYPTION_KEY</text><text x="888" y="610" class="node-detail">Minimum 32 characters</text><text x="888" y="630" class="node-detail">Loaded at startup</text></g><g data-component-id="encryption-service"><title>EncryptionService</title><rect x="870" y="750" width="250" height="150" rx="12" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2"/><rect x="870" y="750" width="250" height="7" rx="4" fill="#f1fa8c"/><text x="888" y="776" class="type-label" textLength="214.0" lengthAdjust="spacingAndGlyphs">CRYPTOGRAPHIC BOUNDARY</text><text x="888" y="802" class="node-label">EncryptionService</text><text x="888" y="828" class="node-detail">PBKDF2-SHA256 · 600,000</text><text x="888" y="848" class="node-detail">Fernet encrypt / decrypt</text></g><g data-component-id="credentials-db"><title>credentials.db</title><rect x="1560" y="710" width="270" height="190" rx="12" fill="#1b1e25" stroke="#ff79c6" stroke-width="2"/><rect x="1560" y="710" width="270" height="7" rx="4" fill="#ff79c6"/><text x="1578" y="736" class="type-label">ENCRYPTED SQLITE</text><text x="1578" y="762" class="node-label">credentials.db</text><text x="1578" y="788" class="node-detail">Ciphertext fields only</text><text x="1578" y="808" class="node-detail">32-byte salt in metadata</text><text x="1578" y="828" class="node-detail">Separate from workflow.db</text></g><g data-callout-id="state-boundary-note"><rect x="100" y="800" width="650" height="110" rx="10" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2" stroke-dasharray="7 6"/><text x="116" y="830" class="callout-title">Blast-radius boundary</text><text x="116" y="856" class="callout-text">A workflow.db dump carries operational state,</text><text x="116" y="878" class="callout-text">but never the encrypted API-key or OAuth tables.</text></g><g data-callout-id="refresh-token-note"><rect x="1525" y="395" width="305" height="115" rx="10" fill="#1b1e25" stroke="#f1fa8c" stroke-width="2" stroke-dasharray="7 6"/><text x="1541" y="425" class="callout-title">Refresh-token rule</text><text x="1541" y="451" class="callout-text" textLength="273.0" lengthAdjust="spacingAndGlyphs">Refresh tokens are never cached.</text><text x="1541" y="473" class="callout-text">AuthService reads them from</text><text x="1541" y="495" class="callout-text">credentials.db for every use.</text></g>
<g aria-label="Legend"><circle cx="72" cy="1038" r="7" fill="#bd93f9"/><text x="86" y="1044" class="legend">Agents / system</text><circle cx="317" cy="1038" r="7" fill="#8be9fd"/><text x="331" y="1044" class="legend">Models / interfaces</text><circle cx="562" cy="1038" r="7" fill="#50fa7b"/><text x="576" y="1044" class="legend">Tools / results</text><circle cx="807" cy="1038" r="7" fill="#ff79c6"/><text x="821" y="1044" class="legend">Triggers / events</text><circle cx="1052" cy="1038" r="7" fill="#ffb86c"/><text x="1066" y="1044" class="legend">Workflow / runtime</text><circle cx="1297" cy="1038" r="7" fill="#f1fa8c"/><text x="1311" y="1044" class="legend">Security note</text></g>
</svg>