Skip to content

Database

Quick Reference

  • Engine: SQLite3
  • ORM: None (Direct SQL for performance and simplicity)
  • Tables: 7 core tables
  • Storage Location: storage/memory.db

ER Diagram

mermaid
erDiagram
    workflows ||--o{ debates : "has reasoning"
    workflows ||--o{ decisions : "produces"
    workflows ||--o{ execution_traces : "logs"
    workflows ||--o{ plans : "contains"
    debates ||--|{ arguments : "collects"
    workflows ||--o{ agent_opinions : "tracks reliability"

    workflows {
        string workflow_id PK
        string request
        string status
        json metadata
        timestamp created_at
    }
    debates {
        string debate_id PK
        string workflow_id FK
        string status
        json final_consensus
    }
    arguments {
        int id PK
        string debate_id FK
        string agent_name
        string argument
        float confidence_score
    }
    decisions {
        string decision_id PK
        string workflow_id FK
        string decision
        json reasoning_trace
    }

Tables

workflows

The root table for all system activity.

ColumnTypeDescription
workflow_idTEXTUnique ID (wf_...)
requestTEXTOriginal user natural language input.
statusTEXTPENDING, COMPLETED, FAILED, REJECTED.
metadataTEXTJSON blob of execution results.

debates

Stores multi-agent reasoning sessions.

ColumnTypeDescription
debate_idTEXTUnique ID (deb_...)
final_consensusTEXTResulting decision and mitigation notes.

agent_opinions

Tracks agent performance over time to calculate reliability weights.

ColumnTypeDescription
agent_nameTEXTe.g., CriticAgent, SecurityAgent.
stanceTEXTAPPROVED or REJECTED.
confidenceREALAgent's self-reported confidence.

Relationships

Table ATable BTypeFK
workflowsdebates1:Mworkflow_id
debatesarguments1:Mdebate_id
workflowsexecution_traces1:Mworkflow_id

Indexes & Constraints

TableIndexColumnsPurpose
workflowsidx_requestrequestSupports similarity lookup (memory/manager.py:85).
execution_tracesidx_tracetrace_idFast retrieval of full reasoning chains.

Performance

The system uses sqlite3.Row factory to enable dictionary-like access to query results, making agent integration more idiomatic.


See Also

Built with DocKit Premium