Skip to content

Entity Schema

Every entity in Lattice has three components: metadata, Telos state, and a type-specific extension.

interface Entity {
id: string; // Format: lat_<type_prefix>_<nanoid(12)>
metadata: EntityMetadata;
telos: TelosState;
extension: EntityExtension;
}

lat_<prefix>_<nanoid> where prefix maps to:

TypePrefixExample
personperlat_per_chen
teamtemlat_tem_platform
departmentdeplat_dep_eng
divisiondivlat_div_products
companycomlat_com_meridian
workflowwfllat_wfl_abc123
resourcereslat_res_xyz789

Common to all entities:

interface EntityMetadata {
name: string;
type: EntityType; // "person" | "team" | "department" | "division" | "company" | "workflow" | "resource"
parentId: string | null; // Hierarchy link
createdAt: string; // ISO 8601
updatedAt: string; // ISO 8601
status: EntityStatus; // "active" | "inactive" | "archived"
tags: string[];
}

Every entity, at every tier, carries the same 18-field Telos state. This is the fractal self-similarity principle — a person’s state has the same shape as a company’s state.

interface TelosState {
problems: string[]; // What problems this entity exists to solve
mission: string | null; // Single mission statement
narratives: Narrative[]; // Descriptive context and stories
goals: Goal[]; // Measurable objectives with status tracking
challenges: Challenge[]; // Obstacles with severity and related goals
strategies: Strategy[]; // Approaches targeting challenges and goals
projects: Project[]; // Scoped work efforts tied to strategies
journal: JournalEntry[]; // Timestamped notes and observations
ideas: Idea[]; // Captured ideas with validation status
beliefs: Belief[]; // Stated beliefs with confidence scores (0.0-1.0)
skills: Skill[]; // Capabilities with proficiency levels
budget: BudgetItem[]; // Financial allocations and spending
team: TeamMember[]; // Member entities with roles
work: WorkItem[]; // Actionable tasks with assignees and priority
documentation: DocumentationEntry[]; // Reference documents
sops: SOP[]; // Standard operating procedures with versioned steps
metrics: Metric[]; // Quantitative measurements with direction and targets
logs: LogEntry[]; // Operational log entries with levels
}

Storage strategy: Telos fields that need querying get their own D1 tables (telos_goals, telos_challenges, telos_strategies, telos_metrics, telos_work_items, telos_budget, telos_team_members). Fields that are read-only or rarely queried are stored as JSON in the telos_json table (narratives, projects, journal, ideas, beliefs, skills, documentation, sops, logs). The problems and mission fields are stored directly on the entities table as telos_problems (JSON array) and telos_mission (text).

interface Goal {
id: string;
title: string;
description: string;
measurable: string; // How to verify completion
targetDate: string | null;
status: "not_started" | "in_progress" | "completed" | "abandoned";
parentGoalId: string | null; // Goal hierarchy (company goal -> division goal -> team goal)
}
interface Challenge {
id: string;
title: string;
description: string;
severity: "low" | "medium" | "high" | "critical";
status: "identified" | "mitigating" | "resolved" | "accepted";
relatedGoalIds: string[]; // Which goals this challenge threatens
}
interface Strategy {
id: string;
title: string;
description: string;
targetChallengeIds: string[]; // Challenges this strategy addresses
targetGoalIds: string[]; // Goals this strategy advances
status: "proposed" | "active" | "completed" | "abandoned";
}
interface WorkItem {
id: string;
title: string;
description: string;
assigneeEntityId: string | null;
status: "backlog" | "todo" | "in_progress" | "review" | "done";
priority: "low" | "medium" | "high" | "urgent";
projectId: string | null;
}
interface Metric {
id: string;
name: string;
value: number;
unit: string;
direction: "higher_better" | "lower_better" | "target";
target: number | null;
measuredAt: string;
}
interface BudgetItem {
id: string;
category: string;
allocated: number;
spent: number;
currency: string;
period: string;
}

Each entity type carries additional typed data beyond the universal Telos state:

interface PersonExtension {
email: string | null;
title: string | null; // Job title
reportsTo: string | null; // Entity ID of manager
directReports: string[]; // Entity IDs of reports
}
interface TeamExtension {
purpose: string | null;
leadEntityId: string | null;
memberEntityIds: string[];
}
interface DepartmentExtension {
function: string; // e.g., "Software Engineering"
headEntityId: string | null;
teamEntityIds: string[];
}
interface DivisionExtension {
region: string | null;
departmentEntityIds: string[];
headEntityId: string | null;
}
interface CompanyExtension {
legalName: string;
industry: string | null;
divisionEntityIds: string[];
employeeCount: number | null;
}
interface WorkflowExtension {
steps: WorkflowStep[];
edges: WorkflowEdge[];
triggerConfig: WorkflowTrigger | null;
}
interface ResourceExtension {
resourceType: "document" | "system" | "tool" | "budget_pool" | "facility";
url: string | null;
accessLevel: "public" | "internal" | "restricted" | "confidential";
ownerEntityId: string | null;
}
type StepType = "decision" | "action" | "tool" | "verification" | "gate";
type StepExecutor = "human" | "ai" | "hybrid" | "system";
interface WorkflowStep {
id: string;
name: string;
type: StepType;
executor: StepExecutor;
description: string;
inputs: string[];
outputs: string[];
subWorkflowId: string | null; // Recursive composition
}
interface WorkflowEdge {
from: string; // Step ID
to: string; // Step ID
condition: string | null; // Conditional branching
}
interface WorkflowTrigger {
type: "manual" | "scheduled" | "event";
config: Record<string, unknown>;
}