Files
amcs/schema/agent_personas.dbml
Hein (Warky) e285a03639
Some checks failed
CI / build-and-test (push) Failing after -31m18s
Add schema for agent personas, parts, traits, and character arcs
- Created tables for agent_personas, agent_parts, agent_traits, and character_arcs.
- Established relationships between personas, parts, skills, guardrails, and traits.
- Added arc stages and their corresponding parts, along with a persona_arc table to track current stages.
- Implemented cascading delete rules for referential integrity.
2026-05-05 09:43:14 +02:00

133 lines
4.1 KiB
Plaintext

Table agent_personas {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [unique, not null]
description text [not null, default: '']
summary text [not null]
detail text [not null, default: '']
compiled_summary text [not null, default: '']
compiled_detail text [not null, default: '']
compiled_at timestamptz
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table agent_parts {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [unique, not null]
part_type text [not null]
description text [not null, default: '']
summary text [not null]
content text [not null, default: '']
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table agent_persona_parts {
persona_id bigint [not null, ref: > agent_personas.id]
part_id bigint [not null, ref: > agent_parts.id]
part_order int [not null, default: 0]
priority int [not null, default: 0]
indexes {
(persona_id, part_id) [pk]
persona_id
}
}
Table agent_persona_skills {
persona_id bigint [not null, ref: > agent_personas.id]
skill_id bigint [not null, ref: > agent_skills.id]
indexes {
(persona_id, skill_id) [pk]
persona_id
}
}
Table agent_persona_guardrails {
persona_id bigint [not null, ref: > agent_personas.id]
guardrail_id bigint [not null, ref: > agent_guardrails.id]
indexes {
(persona_id, guardrail_id) [pk]
persona_id
}
}
Table agent_traits {
id bigserial [pk]
guid uuid [unique, not null, default: `gen_random_uuid()`]
name text [unique, not null]
trait_type text [not null]
description text [not null, default: '']
instruction text [not null, default: '']
tags "text[]" [not null, default: `'{}'`]
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table agent_persona_traits {
persona_id bigint [not null, ref: > agent_personas.id]
trait_id bigint [not null, ref: > agent_traits.id]
indexes {
(persona_id, trait_id) [pk]
persona_id
}
}
Table character_arcs {
id bigserial [pk]
name text [unique, not null]
description text [not null, default: '']
summary text [not null, default: '']
created_at timestamptz [not null, default: `now()`]
updated_at timestamptz [not null, default: `now()`]
}
Table arc_stages {
id bigserial [pk]
arc_id bigint [not null, ref: > character_arcs.id]
name text [not null]
stage_order int [not null, default: 0]
description text [not null, default: '']
condition text [not null, default: '']
created_at timestamptz [not null, default: `now()`]
}
Table arc_stage_parts {
stage_id bigint [not null, ref: > arc_stages.id]
part_id bigint [not null, ref: > agent_parts.id]
indexes {
(stage_id, part_id) [pk]
}
}
Table persona_arc {
persona_id bigint [pk, ref: > agent_personas.id]
arc_id bigint [not null, ref: > character_arcs.id]
current_stage_id bigint [not null, ref: > arc_stages.id]
updated_at timestamptz [not null, default: `now()`]
}
// Cross-file refs (for relspecgo merge)
Ref: agent_persona_parts.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_parts.part_id > agent_parts.id [delete: cascade]
Ref: agent_persona_skills.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_skills.skill_id > agent_skills.id [delete: cascade]
Ref: agent_persona_guardrails.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_guardrails.guardrail_id > agent_guardrails.id [delete: cascade]
Ref: agent_persona_traits.persona_id > agent_personas.id [delete: cascade]
Ref: agent_persona_traits.trait_id > agent_traits.id [delete: cascade]
Ref: arc_stages.arc_id > character_arcs.id [delete: cascade]
Ref: arc_stage_parts.stage_id > arc_stages.id [delete: cascade]
Ref: arc_stage_parts.part_id > agent_parts.id [delete: cascade]
Ref: persona_arc.persona_id > agent_personas.id [delete: cascade]
Ref: persona_arc.arc_id > character_arcs.id
Ref: persona_arc.current_stage_id > arc_stages.id