Skip to Content
Developer DocsDatabaseSchema

Database Schema

AEGIS uses PostgreSQL 15 with three extensions: pgvector for vector similarity search, Apache AGE for the knowledge graph, and uuid-ossp for UUID generation. The schema is initialized from SQL files mounted into the PostgreSQL container at startup.

Schema Initialization

The database is initialized by three SQL files executed in order:

FilePurpose
00-create-extension-age.sqlCreate the AGE extension with IF NOT EXISTS guard
infrastructure/docker/postgres/init.sqlCore tables: audit logs, episodic memories, agents, skills, approvals, conversations, budget
infrastructure/docker/postgres/002_checklist_compliance_tables.sqlChecklist templates, filing checklists, compliance status, rule versions, filing rule snapshots
infrastructure/docker/postgres/007_entity_type_definitions.sqlAdmin-managed entity type system: type definitions, field definitions, relationship rules, RRC mappings
services/agent-config-service/.../001_initial_schema.sqlPrompt management: namespaces, templates, versions, budget tiers, audit log, access control

Extensions

CREATE EXTENSION IF NOT EXISTS vector; -- pgvector for episodic memory CREATE EXTENSION IF NOT EXISTS age; -- Apache AGE for knowledge graph CREATE EXTENSION IF NOT EXISTS "uuid-ossp"; -- UUID generation

Graph Setup

After enabling extensions, the init script creates the AGE graph:

LOAD 'age'; SET search_path = ag_catalog, "$user", public; SELECT create_graph('oilgas'); SET search_path = public, ag_catalog, "$user";

Every PostgreSQL connection that runs Cypher queries must execute LOAD 'age' and SET search_path = ag_catalog, "$user", public before any graph operation. The AgePool class handles this automatically.


Core Tables (init.sql)

audit_logs

Append-only audit trail. Database triggers prevent UPDATE and DELETE operations.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Unique log entry ID
tenant_idVARCHAR(50)NOT NULLTenant isolation key
event_typeVARCHAR(100)NOT NULLType of audit event
event_dataJSONBNOT NULLFull event payload
actor_idVARCHAR(100)Who performed the action
actor_typeVARCHAR(20)default 'system'Actor category (system, user, agent)
created_atTIMESTAMPTZdefault NOW()Event timestamp
signatureVARCHAR(256)HMAC signature for tamper detection

Protection Triggers:

CREATE OR REPLACE FUNCTION prevent_audit_modification() RETURNS TRIGGER AS $$ BEGIN RAISE EXCEPTION 'Audit logs are append-only. Updates and deletes are prohibited.'; END; $$ LANGUAGE plpgsql; CREATE TRIGGER no_update_audit BEFORE UPDATE ON audit_logs FOR EACH ROW EXECUTE FUNCTION prevent_audit_modification(); CREATE TRIGGER no_delete_audit BEFORE DELETE ON audit_logs FOR EACH ROW EXECUTE FUNCTION prevent_audit_modification();

The audit trail is immutable by design. Any attempt to UPDATE or DELETE a row will raise a PostgreSQL exception. This is enforced at the database level, not the application level, so it cannot be bypassed by service code.

users

Authentication accounts for the auth service. Accounts are admin-provisioned (no self-serve signup); passwords are stored as bcrypt hashes.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Unique user ID
emailVARCHAR(255)NOT NULLLogin email (case-insensitively unique)
password_hashTEXTNOT NULLbcrypt password hash
rolesTEXT[]NOT NULL, default ARRAY['operator']Role strings used for RBAC
display_nameVARCHAR(200)Optional display name
is_activeBOOLEANNOT NULL, default TRUEInactive users cannot log in
created_atTIMESTAMPTZdefault NOW()Creation timestamp
updated_atTIMESTAMPTZdefault NOW()Last update timestamp

Indexes:

IndexTypeColumnsNotes
idx_users_email_lowerUNIQUELOWER(email)Enforces case-insensitive email uniqueness (no citext extension)

This table is created in init.sql for fresh databases. For existing databases, apply the standalone idempotent migration infrastructure/deploy/migrations/001_users.sql.

episodic_memories

Conversation summaries with vector embeddings for semantic search.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Memory ID
agent_idVARCHAR(100)NOT NULLWhich agent generated this memory
user_idVARCHAR(100)User who participated in the conversation
conversation_idVARCHAR(100)NOT NULLSource conversation
summaryTEXTNOT NULLHuman-readable summary
key_decisionsJSONBDecisions made during the conversation
entities_mentionedJSONBEntity IDs referenced
tools_calledJSONBTools invoked during execution
embeddingvector(1536)OpenAI text-embedding-3-small vector
created_atTIMESTAMPTZdefault NOW()Creation timestamp

Indexes:

IndexTypeColumnsNotes
idx_episodic_embeddingIVFFlatembedding vector_cosine_opsWITH (lists = 100) for cosine similarity
idx_episodic_agent_userB-tree(agent_id, user_id)Filter by agent and user

agents

Agent definitions with configuration, system prompts, and skill assignments.

ColumnTypeConstraintsDescription
idVARCHAR(100)PRIMARY KEYAgent identifier (e.g., rule37-agent)
nameVARCHAR(200)NOT NULLDisplay name
configJSONBNOT NULLSystem prompt, model prefs, skills, budgets, HITL policies
statusVARCHAR(20)default 'active'Agent status
created_atTIMESTAMPTZdefault NOW()Creation timestamp
updated_atTIMESTAMPTZdefault NOW()Last update timestamp

skills

Skill registry with the three-tier injection architecture.

ColumnTypeConstraintsDescription
idVARCHAR(100)PRIMARY KEYSkill identifier (e.g., spacing-calculation)
nameVARCHAR(200)NOT NULLDisplay name
tier1_manifestJSONBNOT NULLTier 1: name, description, triggers (~50 tokens)
tier2_definitionJSONBNOT NULLTier 2: full specification (~200-800 tokens)
tier3_artifact_refsJSONBTier 3: references to artifact content
domain_tagsVARCHAR(100)[]Array of domain labels for skill matching
statusVARCHAR(20)default 'active'Skill status
created_atTIMESTAMPTZdefault NOW()Creation timestamp
updated_atTIMESTAMPTZdefault NOW()Last update timestamp

skill_artifacts

Tier 3 artifact content for skills (reference tables, form guides, regulatory text).

ColumnTypeConstraintsDescription
idVARCHAR(100)PRIMARY KEYArtifact identifier
skill_idVARCHAR(100)REFERENCES skills(id)Parent skill
nameVARCHAR(200)NOT NULLArtifact name
contentTEXTNOT NULLFull artifact content
content_hashVARCHAR(64)NOT NULLSHA-256 hash for change detection
token_estimateINTApproximate token count
created_atTIMESTAMPTZdefault NOW()Creation timestamp

approval_requests

HITL approval requests for agent execution checkpoints.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Request ID
execution_idVARCHAR(100)NOT NULLAgent execution ID
agent_idVARCHAR(100)NOT NULLAgent that created the request
checkpoint_typeVARCHAR(100)NOT NULLHITL checkpoint type (e.g., pre_filing)
state_snapshotJSONBNOT NULLFull agent state at checkpoint
reviewer_idVARCHAR(100)Assigned reviewer
reviewer_strategyVARCHAR(50)NOT NULLAssignment strategy: named_individual or role_based
statusVARCHAR(20)default 'pending'Request status
decisionVARCHAR(20)Reviewer decision: approved, rejected, modified
reviewer_commentsTEXTReviewer feedback
created_atTIMESTAMPTZdefault NOW()Creation timestamp
decided_atTIMESTAMPTZDecision timestamp

Index:

IndexColumnsPurpose
idx_approval_status(status, reviewer_id)Filter pending approvals by reviewer

conversations

Conversation sessions linking users to agents.

ColumnTypeConstraintsDescription
idVARCHAR(100)PRIMARY KEYConversation ID
agent_idVARCHAR(100)NOT NULLAssigned agent
user_idVARCHAR(100)Participating user
statusVARCHAR(20)default 'active'Conversation status
metadataJSONBAdditional metadata
created_atTIMESTAMPTZdefault NOW()Creation timestamp
updated_atTIMESTAMPTZdefault NOW()Last activity

budget_usage

Token and cost tracking per agent execution.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Record ID
agent_idVARCHAR(100)NOT NULLAgent identifier
execution_idVARCHAR(100)NOT NULLExecution identifier
tokens_usedINTNOT NULLTotal tokens consumed
cost_usdDECIMAL(10,6)Dollar cost of the execution
modelVARCHAR(100)LLM model used
created_atTIMESTAMPTZdefault NOW()Record timestamp

Checklist & Compliance Tables (002_checklist_compliance_tables.sql)

checklist_templates

Templates defining the checklist structure for each compliance domain (one template per domain per version).

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Template ID
tenant_idVARCHAR(50)NOT NULLTenant key
compliance_domainVARCHAR(50)NOT NULLDomain: rule_37, rule_32, form_pr, flaring_monitor
versionINTdefault 1Template version
itemsJSONBNOT NULLOrdered array of checklist item definitions
min_required_itemsJSONBItem indices required for HITL submission
created_atTIMESTAMPTZdefault NOW()Creation timestamp
updated_atTIMESTAMPTZdefault NOW()Last update

Unique constraint: (tenant_id, compliance_domain, version)

filing_checklists

Active checklist instances — one per entity per compliance domain work session.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Checklist instance ID
tenant_idVARCHAR(50)NOT NULLTenant key
entity_idVARCHAR(255)NOT NULLKG entity ID (well API#, facility ID)
entity_typeVARCHAR(50)NOT NULLEntity type: well, lease, facility, etc.
entity_nameVARCHAR(500)Display name
compliance_domainVARCHAR(50)NOT NULLCompliance domain
template_idUUIDREFERENCES checklist_templates(id)Source template
statusVARCHAR(20)default 'draft', CHECK constraintFiling status
deadlineTIMESTAMPTZFiling deadline
itemsJSONBNOT NULLCurrent state of each checklist item
metadataJSONBdefault '{}'Conversation IDs, reviewer notes, alerts
created_byVARCHAR(255)Who initiated the checklist
created_atTIMESTAMPTZdefault NOW()Creation timestamp
updated_atTIMESTAMPTZdefault NOW()Last update

Status values: draft, in_progress, ready_for_review, in_review, approved, rejected, filed, exception

Indexes:

IndexColumns
idx_filing_checklists_entity(tenant_id, entity_id, compliance_domain)
idx_filing_checklists_status(tenant_id, status)

checklist_artifacts

Generated documents, PDFs, and data exports attached to checklist items.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Artifact ID
checklist_idUUIDREFERENCES filing_checklists(id) ON DELETE CASCADEParent checklist
item_indexINTNOT NULLChecklist item this artifact belongs to
artifact_typeVARCHAR(50)NOT NULLType: document, pdf, plat_draft, data_export, waiver, form_draft
nameVARCHAR(500)NOT NULLArtifact name
content_typeVARCHAR(100)MIME type
contentTEXTText/markdown/JSON content
file_pathVARCHAR(1000)Path for binary artifacts
metadataJSONBdefault '{}'Source attribution, version, confidence
generated_byVARCHAR(50)CHECK IN ('agent', 'user', 'system')Who created the artifact
created_atTIMESTAMPTZdefault NOW()Creation timestamp

Index: idx_checklist_artifacts_checklist on (checklist_id, item_index)

compliance_status

Materialized cache of the entity-by-domain compliance matrix.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Row ID
tenant_idVARCHAR(50)NOT NULLTenant key
entity_idVARCHAR(255)NOT NULLKG entity ID
entity_typeVARCHAR(50)NOT NULLEntity type
entity_nameVARCHAR(500)Display name
entity_fieldVARCHAR(255)Field name from KG
entity_districtVARCHAR(10)RRC district
compliance_domainVARCHAR(50)NOT NULLCompliance domain
statusVARCHAR(20)NOT NULL, CHECK constraintCompliance status
deadlineTIMESTAMPTZNext deadline for this domain
checklist_idUUIDREFERENCES filing_checklists(id)Active checklist if exists
detailsJSONBdefault '{}'Domain-specific status details
last_assessed_atTIMESTAMPTZdefault NOW()Last assessment timestamp

Status values: compliant, action_needed, overdue, not_applicable, in_review

Unique constraint: (tenant_id, entity_id, compliance_domain)

Indexes:

IndexColumns
idx_compliance_status_tenant(tenant_id, status)
idx_compliance_status_domain(tenant_id, compliance_domain)
idx_compliance_status_deadline(tenant_id, deadline)

rule_versions

Immutable, versioned regulatory rules. Never UPDATE existing rules — always create a new version.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Rule version ID
tenant_idVARCHAR(50)NOT NULLTenant key
rule_typeVARCHAR(50)NOT NULLstatewide, field_specific, notice
rule_domainVARCHAR(50)NOT NULLspacing, density, flaring, reporting
rule_identifierVARCHAR(255)NOT NULLUnique rule key (e.g., SWR_37)
versionINTNOT NULLVersion number (monotonically increasing)
effective_dateDATENOT NULLWhen the rule took effect
superseded_dateDATEWhen superseded (NULL if current)
sourceVARCHAR(50)NOT NULLrrc_ingestion, rule_monitor_agent, manual, docket_hearing
source_referenceVARCHAR(500)Citation, docket number, URL
rule_dataJSONBNOT NULLActual rule parameters
graph_node_idVARCHAR(255)Reference to KG node
change_summaryTEXTWhat changed in this version
detected_atTIMESTAMPTZdefault NOW()When the change was detected
detected_byVARCHAR(100)Who/what detected the change
statusVARCHAR(20)default 'active', CHECK constraintRule status

Status values: active, superseded, pending_review, draft

Unique constraint: (tenant_id, rule_identifier, version)

Indexes:

IndexColumnsNotes
idx_rule_versions_active(tenant_id, rule_identifier, status)Partial: WHERE status = 'active'
idx_rule_versions_domain(tenant_id, rule_domain)

filing_rule_snapshots

Frozen copies of rules at the time a filing was initiated. Used for stale detection.

ColumnTypeConstraintsDescription
idUUIDPRIMARY KEY, default uuid_generate_v4()Snapshot ID
checklist_idUUIDREFERENCES filing_checklists(id) ON DELETE CASCADEParent checklist
rule_version_idUUIDREFERENCES rule_versions(id)Original rule version
snapshotted_atTIMESTAMPTZdefault NOW()Snapshot timestamp
rule_data_at_snapshotJSONBNOT NULLFrozen copy of rule_data
is_currentBOOLEANdefault trueFalse if rule has been superseded
superseded_byUUIDREFERENCES rule_versions(id)Newer version if superseded
acknowledgedBOOLEANdefault falseUser acknowledged the stale rule
acknowledged_byVARCHAR(255)Who acknowledged
acknowledged_atTIMESTAMPTZWhen acknowledged

Indexes:

IndexColumnsNotes
idx_filing_rule_snapshots_checklist(checklist_id)
idx_filing_rule_snapshots_stale(is_current)Partial: WHERE is_current = false

Entity Type System Tables (007_entity_type_definitions.sql)

entity_type_definitions

Admin-managed entity type schemas (e.g., Well, Facility, Wellpad).

ColumnTypeConstraintsDescription
type_idUUIDPRIMARY KEY, default gen_random_uuid()Type ID
tenant_idUUIDNOT NULLTenant key
type_keyVARCHAR(64)NOT NULLMachine key (e.g., well, facility)
display_nameVARCHAR(128)NOT NULLUI display name
iconVARCHAR(64)Icon identifier
colorVARCHAR(7)Hex color code
compliance_footprintBOOLEANNOT NULL, default falseWhether this type appears in compliance matrix
is_system_typeBOOLEANNOT NULL, default falseSystem types cannot be deleted
created_atTIMESTAMPTZNOT NULL, default NOW()Creation timestamp
updated_atTIMESTAMPTZNOT NULL, default NOW()Auto-updated via trigger

Unique constraint: (tenant_id, type_key)

Index: idx_etd_tenant on (tenant_id)

Auto-update trigger: trg_etd_updated fires BEFORE UPDATE to set updated_at = NOW().

entity_field_definitions

Field definitions for each entity type (dynamic schema).

ColumnTypeConstraintsDescription
field_idUUIDPRIMARY KEY, default gen_random_uuid()Field ID
type_idUUIDNOT NULL, REFERENCES entity_type_definitions(type_id) ON DELETE CASCADEParent entity type
tenant_idUUIDNOT NULLTenant key
field_keyVARCHAR(64)NOT NULLMachine key (e.g., api_number)
labelVARCHAR(128)NOT NULLDisplay label
input_typeVARCHAR(32)NOT NULLInput type (text, number, date, select, etc.)
requiredBOOLEANNOT NULL, default falseWhether field is required
validation_presetVARCHAR(64)Preset validation rule
optionsJSONBOptions for select/enum fields
display_groupVARCHAR(64)UI grouping
sort_orderINTEGERNOT NULL, default 0Display order
created_atTIMESTAMPTZNOT NULL, default NOW()Creation timestamp

Unique constraint: (type_id, field_key)

Index: idx_efd_type_order on (type_id, sort_order)

entity_relationship_rules

Defines allowed relationships between entity types.

ColumnTypeConstraintsDescription
rule_idUUIDPRIMARY KEY, default gen_random_uuid()Rule ID
tenant_idUUIDNOT NULLTenant key
parent_type_idUUIDNOT NULL, REFERENCES entity_type_definitions(type_id) ON DELETE CASCADEParent entity type
child_type_idUUIDNOT NULL, REFERENCES entity_type_definitions(type_id) ON DELETE CASCADEChild entity type
cardinalityVARCHAR(16)NOT NULL, default 'one_to_many'Relationship cardinality
requiredBOOLEANNOT NULL, default falseWhether relationship is required
display_labelVARCHAR(128)UI label for the relationship
created_atTIMESTAMPTZNOT NULL, default NOW()Creation timestamp

Unique constraint: (tenant_id, parent_type_id, child_type_id)

Indexes: idx_err_tenant, idx_err_parent, idx_err_child

rrc_field_mappings

Maps RRC data fields to entity field definitions for automated data import.

ColumnTypeConstraintsDescription
mapping_idUUIDPRIMARY KEY, default gen_random_uuid()Mapping ID
tenant_idUUIDNOT NULLTenant key
type_idUUIDNOT NULL, REFERENCES entity_type_definitions(type_id) ON DELETE CASCADEEntity type
rrc_field_keyVARCHAR(128)NOT NULLRRC field name
entity_field_idUUIDNOT NULL, REFERENCES entity_field_definitions(field_id) ON DELETE CASCADETarget entity field
created_atTIMESTAMPTZNOT NULL, default NOW()Creation timestamp

Index: idx_rfm_type on (type_id)


Connecting to the Database

# Via psql psql -h localhost -U aegis -d aegis # Password: aegis_local (from docker-compose.yml)

Prompt Management Tables (008_prompt_management.sql)

These tables support the agent-config-service’s prompt template management system.

prompt_namespaces

Organizes prompt templates into named groups with approval and access settings.

ColumnTypeDescription
idUUIDPrimary key
tenant_idUUIDTenant isolation
namespace_keyVARCHAR(64)Unique key within tenant (e.g., agents)
display_nameVARCHAR(255)Human-readable name
auto_approveBOOLEANSkip approval on promotion to active
approversTEXT[]List of approver user IDs
max_render_timeoutINTEGERRender timeout in milliseconds
data_classificationVARCHAR(20)public, internal, confidential, restricted

prompt_budget_tiers

Token budget limits per namespace.

ColumnTypeDescription
idUUIDPrimary key
namespace_idUUIDFK to prompt_namespaces
tier_keyVARCHAR(64)Unique key within namespace
max_tokensINTEGERMaximum token count for prompts in this tier

prompt_templates

Prompt template metadata with a pointer to the active version.

ColumnTypeDescription
idUUIDPrimary key
namespace_idUUIDFK to prompt_namespaces
slugVARCHAR(128)Unique identifier within namespace
budget_tier_idUUIDFK to prompt_budget_tiers (optional)
expected_variablesJSONBVariable definitions for the template
active_version_idUUIDFK to the currently active prompt_version

prompt_versions

Versioned prompt bodies with lifecycle status and validation results.

ColumnTypeDescription
idUUIDPrimary key
template_idUUIDFK to prompt_templates
version_numberINTEGERAuto-incrementing per template
statusVARCHAR(20)draft, pre_production, active, archived
bodyTEXTJinja2 template content
draft_owner_idVARCHAR(255)Owner (only for drafts)
target_usersTEXT[]Pre-prod targeting list
validation_resultJSONBFull validation pipeline result
author_idVARCHAR(255)Who created this version
approved_byVARCHAR(255)Who approved activation

Partial unique indexes enforce: one draft per user per template, one pre-prod per template, one active per template.

prompt_audit_log

Append-only, HMAC-signed audit trail for all prompt lifecycle events. Triggers prevent UPDATE and DELETE.

ColumnTypeDescription
idUUIDPrimary key
tenant_idUUIDTenant isolation
template_idUUIDFK to prompt_templates
version_idUUIDFK to prompt_versions
actionVARCHAR(30)Lifecycle event type
actor_idVARCHAR(255)Who performed the action
hmac_signatureVARCHAR(128)HMAC-SHA256 tamper detection

namespace_access_control

Role-based access control per namespace per user.

ColumnTypeDescription
namespace_idUUIDFK to prompt_namespaces
user_idVARCHAR(255)User identifier
roleVARCHAR(20)viewer, author, approver, admin
granted_byVARCHAR(255)Who granted this access

Skills-Based Agent Tables (agent-config-service, R35)

These tables back the R35 skills-based agent architecture. As of R35 Phase 3a the skill-loading source reads themsystem_prompt_node resolves the agent_definitions row by agent_key (= agent_type) via fetch_agent_definition (a direct Postgres read over the orchestration pool) and loads its root_skill_key skill (rule_37rrc_rule37, rule_32rrc_rule32, general → NULL = no task skill). AGENT_DEFAULT_SKILLS is demoted to a fallback that fires only for an unseeded tenant (no row → fetch returns None); a seeded row is authoritative, so there is no double-load. As of P3b prompts are assembled from skill personas + context templates (no longer FALLBACK_PROMPTS), and as of P4 the visible tool list derives from core capabilities + the loaded skills’ llm_visible code blocks (AGENT_TOOLS / get_tools_for_agent deleted; the lone R35-FENCE keeps the hardcoded set for the deferred flaring_monitor / compliance_monitor agents).

skill_personas (008_skill_persona_and_flags.sql)

A persona is the voice/identity for a skill. Either an inline prompt_text or an R29 prompt-template slug (prompt_template_ref) — exactly one of the two (enforced at the app layer).

ColumnTypeDescription
idUUIDPrimary key
skill_idUUIDFK to skill_definitions(id) (the UUID, ON DELETE CASCADE)
persona_keyVARCHAR(128)Unique within skill (UNIQUE (skill_id, persona_key))
display_nameVARCHAR(255)Human-readable name
prompt_textTEXTInline persona prompt (voice/identity only)
prompt_template_refVARCHAR(255)OR an R29 prompt-template slug
is_defaultBOOLEANAt most one default per skill (partial unique index WHERE is_default)
sort_orderINTEGERDisplay ordering

agent_definitions (009_agent_definitions.sql)

Platform/agent records. Seeded dormant in P1 (general, rule_37, rule_32).

ColumnTypeDescription
idUUIDPrimary key
tenant_idUUIDTenant isolation (UNIQUE (tenant_id, agent_key))
agent_keyVARCHAR(128)Agent identifier (e.g. rule_37)
root_skill_keyVARCHAR(128)SLUGskill_definitions.skill_key (NULL = general mode). No FK — it references the slug, not the UUID PK; the slug→UUID lookup happens once at load (orchestration/integrity.py:resolve_skill_uuid). Do not “fix” into a UUID FK.
persona_keyVARCHAR(128)NULL = root skill default, else platform default
model_configJSONBModel preference (mirrors the live DEFAULT_LLM_MODEL)
loaded_skillsTEXT[]Carried to honor the 004_skill_schema.sql DO-block contract
is_active / is_systemBOOLEANFlags

New columns on existing skill tables (008)

TableColumnTypeDescription
skill_code_blocksllm_visibleBOOLEAN NOT NULL DEFAULT trueLightweight tool-visibility flag (R35 §11.3)
skill_definitionscontext_modeVARCHAR(20) NOT NULL DEFAULT 'reason_alongside'reason_alongside | compute_and_return (R35 §11.4; isolating runtime deferred to the Sub-Agent release)

A startup integrity check (orchestration-engine) verifies that every active agent_definition’s root_skill_key / persona_key resolves. It is warn-not-fail in R35 P1 (the rrc_rule37 / rrc_rule32 skills land in P2) and flips to fail-loud via the R35_INTEGRITY_FAIL_LOUD env var.


Key Source Files

FilePurpose
infrastructure/docker/postgres/init.sqlCore table definitions
infrastructure/docker/postgres/002_checklist_compliance_tables.sqlChecklist, compliance, and rule tables
infrastructure/docker/postgres/007_entity_type_definitions.sqlEntity type system tables
infrastructure/docker/postgres/00-create-extension-age.sqlAGE extension setup
services/agent-config-service/src/agent_config/migrations/001_initial_schema.sqlPrompt management tables
services/agent-config-service/src/agent_config/migrations/008_skill_persona_and_flags.sqlR35: skill_personas, llm_visible, context_mode
services/agent-config-service/src/agent_config/migrations/009_agent_definitions.sqlR35: agent_definitions table
shared/src/aegis_shared/db/postgres.pyAsyncPG connection pool helpers
Last updated on