// types.el — DHARMA data model type definitions. // // Every type here maps to an engram graph node. Records are stored as JSON // in the node content field, tagged with a _type discriminator. // Lookups are done by scanning nodes and filtering by _type and id. // // Founding stable IDs (never change): // Principal: 00000000-0001-0000-0000-000000000001 (William Christopher Anderson) // CGI: 00000000-0002-0000-0000-000000000001 (Neuron) // Eval: 00000000-0003-0000-0000-000000000001 (Neuron evaluation) type Principal { id: String name: String email: String created_at: Int agreement_hash: String agreement_signed_at: Int } type CGI { id: String name: String principal_id: String founding_practitioner_id: String seed_hash: String evaluation_record_id: String registered_at: Int status: String dharma_score: Float version: Int } type EvaluationRecord { id: String cgi_id: String stage1_completed: Bool stage1_completed_at: Int stage2_completed: Bool stage2_completed_at: Int stage3_completed: Bool stage3_completed_at: Int capture_authorized: Bool authorized_by: String authorized_at: Int final_score: Float notes: String } type AccumulationRecord { id: String cgi_id: String version: Int document_hash: String signed_by: String created_at: Int superseded_at: Int } type DriftEvent { id: String cgi_id: String detected_at: Int severity: String description: String resolved: Bool resolved_at: Int resolution_notes: String } type KindredGrant { id: String grantor_cgi_id: String grantee_cgi_id: String authorized_by: String granted_at: Int expires_at: Int } type AuditRecord { id: String identity_hash: String timestamp_utc: Int feature: String direction: String payload_bytes: Int encryption_verified: Bool session_id: String } // InternalStateEvent — the evidence trail for structural responses. // // The whole point of this record is to make the *gap* between pre-reasoning // noticing and post-reasoning response inspectable. Compression metrics // (compression_ratio, gap_direction) are kept for backward compatibility, // but the content fields (pre_reasoning, post_reasoning, gap_summary) are // where the actual evidence lives. // // Two-step write pattern (the timestamp gap is the proof): // 1. POST /internal-state with {cgi_id, event_id, trigger, domain, // pre_reasoning, pre_logged_at, ...} — captures the raw noticing // *before* reasoning has shaped it. Returns the new id. // 2. PATCH /internal-state/{id} with {post_reasoning, gap_summary, // gap_direction, compression_ratio} — fills in the post-reasoning // side once the response has been built. // // pre_reasoning, pre_logged_at, cgi_id, event_id, trigger, domain are // IMMUTABLE after the initial POST. PATCH only fills in the post side. // // Existing records without the new fields remain readable — additions are // purely additive at the JSON level. type InternalStateEvent { id: String cgi_id: String event_id: String trigger: String domain: String pre_reasoning: String // raw noticing, before any reasoning pre_logged_at: Int // timestamp of the pre-capture (proof of "before") post_reasoning: String // what was actually said/done after reasoning (set via PATCH) gap_summary: String // short prose summary of the gap (set via PATCH) compression_ratio: Float gap_direction: String // categorical: "softened" | "intensified" | "redirected" | "" tags: String logged_at: Int // when the full record was committed (POST timestamp) }