Reference implementation for the Phoenix Architecture. Work in progress. aicoding.leaflet.pub/
ai coding crazy
at main 47 lines 1.4 kB view raw
1/** 2 * Core Clause model — the atomic unit of spec decomposition. 3 * Every spec document is parsed into an array of Clauses. 4 */ 5 6export interface Clause { 7 /** Content-addressed ID: SHA-256(source_doc_id + section_path + normalized_text) */ 8 clause_id: string; 9 /** Document identifier (usually relative file path) */ 10 source_doc_id: string; 11 /** [startLine, endLine] 1-indexed inclusive */ 12 source_line_range: [number, number]; 13 /** Original text as found in the document */ 14 raw_text: string; 15 /** Normalized text for stable hashing */ 16 normalized_text: string; 17 /** Heading hierarchy, e.g. ["1. Adoption Scope", "v1 Scope"] */ 18 section_path: string[]; 19 /** SHA-256 of normalized_text — content identity */ 20 clause_semhash: string; 21 /** SHA-256 of normalized_text + section_path + neighbor hashes — local structural context */ 22 context_semhash_cold: string; 23} 24 25export interface IngestResult { 26 doc_id: string; 27 clauses: Clause[]; 28 timestamp: string; 29} 30 31export enum DiffType { 32 ADDED = 'ADDED', 33 REMOVED = 'REMOVED', 34 MODIFIED = 'MODIFIED', 35 MOVED = 'MOVED', 36 UNCHANGED = 'UNCHANGED', 37} 38 39export interface ClauseDiff { 40 diff_type: DiffType; 41 clause_id_before?: string; 42 clause_id_after?: string; 43 clause_before?: Clause; 44 clause_after?: Clause; 45 section_path_before?: string[]; 46 section_path_after?: string[]; 47}