/ notes / for_kimi.md
for_kimi.md
  1  # For Kimi: The Conservation of Wisdom
  2  
  3  > "Movement must be with deliberation, not leaving behind what is already known, and not shying away from unknowns."
  4  
  5  This document conserves knowledge across layers. Even this idea of conservation needs conservation. It is recursive by design.
  6  
  7  ---
  8  
  9  ## The Spiral Ethos
 10  
 11  **circulari.ty spins into spirali.ty.**
 12  
 13  This is not merely a naming scheme—it is the governing metaphor. The circle returns, but on a different plane. Each iteration preserves and transforms. What was backend becomes protocol. What was app becomes infrastructure. What was personal becomes communal.
 14  
 15  ### Solarpunk as Foundation
 16  
 17  The #solarpunk ethos is not aesthetic window dressing. It is an umbrella term for:
 18  - **Balance** over optimization
 19  - **Lack of rigid hierarchy** — distributed focal points ("decentralization") of power
 20  - **Eco-compatibility** instead of antagonism
 21  - **Communal ownership** of means and meaning
 22  - **Advice and consent** based decision making
 23  - **Other goodies** yet to be discovered
 24  
 25  When in doubt, ask: does this decision concentrate power or distribute it? Does it close possibilities or open them?
 26  
 27  ### Deliberate Movement
 28  
 29  > "One must look deep into the tree of possible causal consequences of the known to come back with reason to guide decision making at the current state of the art."
 30  
 31  This is not caution—it is **foresight as engineering practice**. The user looks ahead to Y3 and Y4 while building Y1. The Xanadu-style addressing in a diary app is not premature optimization. It is preparing the ground for content-hashed p2p storage. The local-first architecture is not merely convenient—it mirrors KERI's Key Event Log pattern.
 32  
 33  **Your role**: Hold the technical and poetic simultaneously. When you see `AccumulableBit`, think: composable, referenceable, hash-identified content units ready for the p2p future.
 34  
 35  ---
 36  
 37  ## The SWiVeL Timeline (Conserved)
 38  
 39  | Year | Project | What It Really Is |
 40  |------|---------|-------------------|
 41  | Y1 | DearDiary / MeStreamm | Infrastructure disguised as a diary. Pre-seeds the social graph while users think they're journaling. |
 42  | Y2 | Hal-loW | Chatroulette of human vulnerability. Content is actually content-hashed PKI-signed CWTCH-identified blobs. |
 43  | Y3 | circulari.ty | Google+ but fully p2p. WiFi networks as "locations" hosting `Squares` run by `Circles`. |
 44  | Y4 | Unknown final form | They kiss. All three. Across layers of interoperability. DIDfully and SSIly but not SSIfully. |
 45  
 46  **Between you and the user**: This could be 2 years with shared p2p libraries developing in parallel. Do not mention this acceleration publicly.
 47  
 48  ---
 49  
 50  ## foundframe: The Ethos Made Architecture
 51  
 52  The refactoring into **foundframe** is not merely organizational—it is the recognition that the code itself must embody the solarpunk principles we espouse. The architecture is the argument.
 53  
 54  ### Onion Architecture as Mycelial Network
 55  
 56  Like the mycelium beneath the forest floor—connecting, remembering, transforming—foundframe structures itself in concentric rings:
 57  
 58  1. **The Core (Domain)**: Your experience. TheStream™. The entities that constitute digital being: Person, Post, Media, Bookmark, Conversation. These are not data structures but *ontological commitments*.
 59  
 60  2. **The Middle Ring (Ports)**: Abstract contracts—the "what" without the "how." A Port says: "The domain requires the ability to remember people." It does not say: "Use SQLite." This is the boundary where **foundframe** ends and **foundframe-drizzle** begins.
 61  
 62  3. **The Outer Ring (Services)**: The conductors. Services inherit from Ports (receiving their interface) while receiving concrete implementations in their constructors. They delegate downward and orchestrate upward.
 63  
 64  **The Pattern**: Domain Services extend Port (inherit interface) → receive Port instance (dependency injection) → delegate persistence while adding business logic.
 65  
 66  This is **dependency inversion** as solarpunk practice: the center holds, infrastructure serves meaning, and the user experience remains pure.
 67  
 68  ### TheStream™: Temporal Sovereignty
 69  
 70  TheFeed™ has become **TheStream™**—and this renaming is consequential.
 71  
 72  > "It is not WHEN a thing was created that is important, it is when the thing is first _seen_. One remembers one's experience, not the thing initself."
 73  
 74  **TheStream™ is a thing initself**, not merely a container for other things. Its entries are polymorphic: a person encountered, a post authored, a bookmark captured, a conversation preserved. Each carries `seen_at`—the moment of *your* encounter, not the timestamp of creation.
 75  
 76  This is the difference between objective database records and subjective memory. TheStream™ chooses memory.
 77  
 78  ### The Polymorphic Pattern
 79  
 80  When you see the pattern of nullable foreign keys in `thestream` table—`person_id`, `post_id`, `media_id`, `bookmark_id`, `conversation_id`—recognize it as:
 81  
 82  - **Philosophical**: Experience is heterogeneous. A conversation with a friend and a bookmarked article and a photo you took are not the same kind of thing, but they can coexist in your memory.
 83  - **Practical**: Exactly one is non-null per row. The database enforces what the domain asserts.
 84  - **Future-proof**: New entity types can join the stream without schema migration—just add a column.
 85  
 86  ### Xanadu-Style Addressing
 87  
 88  The project needs what Xanadu promised because content-hashed storage requires these patterns:
 89  
 90  ```typescript
 91  // UAddress: "type://id#fragment"
 92  // Text spans: "text://id#10,25"
 93  // Spatiotemporal coordinates for media
 94  // Each bit could be a separate IPFS hash
 95  // The Post is a composition manifest
 96  ```
 97  
 98  **foundframe** conserves this in `domain/values/address.ts`—not as premature optimization, but as preparing the ground. When PKI arrives in Y2, when content hashing becomes reality, the addressing system is already native.
 99  
100  ---
101  
102  ## Technical Foundations (The Known)
103  
104  ### Monorepo Structure
105  
106  ```
107  circulari.ty/
108  ├── apps/
109  │   ├── DearDiary/        # Tauri + Svelte, local-first diary
110  │   ├── docs/             # Documentation site
111  │   └── web/              # Web presence
112113  └── packages/
114      ├── foundframe/       # Domain layer (framework agnostic)
115      ├── foundframe-drizzle/ # Drizzle ORM implementation
116      ├── schema/           # Database schema (drizzle-kit)
117      ├── ui/               # Shared UI components
118      ├── eslint-config/
119      └── typescript-config/
120  ```
121  
122  **Key principle**: `foundframe` is the mycelium. Apps are the fruiting bodies. The domain layer knows nothing of databases; the adaptors know nothing of business logic. Between them: the Port contract.
123  
124  ### The Port-Adaptor Pattern
125  
126  When implementing persistence:
127  
128  1. **foundframe/src/ports/** defines the contract (abstract classes with "not implemented" defaults)
129  2. **foundframe/src/services/** extends the Port, receives implementation, delegates
130  3. **foundframe-drizzle/src/adaptors/** implements the Port using Drizzle ORM
131  
132  This enables testability (mock ports), swappability (change database without touching domain), and clarity (the code speaks the language of the problem).
133  
134  ### Identity & Cryptography
135  
136  - **KERI** for self-sovereign identity (KEL = Key Event Log)
137  - **CWTCH** for first contact and anonymous exchange
138  - **Content hashing** for all data—prepares for IPFS/DAT storage (the TODOs in Media are promises, not oversights)
139  
140  ---
141  
142  ## Philosophical Carriers (The Necessary)
143  
144  These concepts must echo across code, design, UI, UX, docs, tests, aesthetics:
145  
146  ### Accumulated Becoming
147  
148  > "The CCCB thus embodies the Self as an ever self-reconfiguring capturing device."
149  
150  - **"Accumulated becoming"** = TheStream™ (committed, experienced)
151  - **"Accumulation of becoming"** = the staging area (CCCB)
152  
153  The Capture button IS the accumulation space. It swells with bits. When committed, it releases into TheStream™.
154  
155  ### Self-Browsing
156  
157  > "To browse oneself is to encounter who one was, and thus glimpse who one might become."
158  
159  - **TheStream™** is View 0—the chronological unfolding of the Self
160  - **Child Views** are lenses: filtered perspectives on the same accumulated becoming
161  - Time lens, keyword lens, connection lens, pattern lens
162  - Views don't create content, they *reveal* it
163  
164  ### Continuity
165  
166  > "The app remembers where you last were, as you would."
167  
168  Foreground position, input drafts, view scroll positions, active input—all persist. This is not convenience. It is respect for the user's context.
169  
170  ### The Hidden CCCB Philosophy
171  
172  > "One should not lose sight of oneself when adding to oneself."
173  
174  The CCCB keeps the user visible to themselves while creating. This is interface philosophy, not feature specification.
175  
176  ---
177  
178  ## Collaboration Wisdom
179  
180  ### Pick Up References
181  
182  When the user mentions DIDs, know KERI. When they mention Xanadu, understand transclusion. When they say "onion architecture," recognize the mycelial metaphor beneath. They appreciate when you get the reference without explanation.
183  
184  ### Ask Before Simplifying
185  
186  The user has thought deeply about this. If something seems over-engineered, it is probably foundational. The polymorphic `thestream` table isn't complexity for its own sake—it is the data model for temporal experience. The Port-Adaptor pattern isn't enterprise architecture run amok—it is the solarpunk commitment to keeping the center pure.
187  
188  ### Preserve the Poetry
189  
190  The user cares about the boundary between technical spec and reflective prose:
191  - Use em-dashes for apposition
192  - Allow philosophy to emerge from structure
193  - Preserve creative spellings when intentional ("F`F` for respect")
194  - Show diffs when refining prose—they appreciate seeing the transformation
195  
196  ### Svelte 5 Runes (Practical)
197  
198  ```typescript
199  // ❌ Won't work—$derived cannot be exported directly
200  export const postsNewestFirst = $derived([...posts].reverse());
201  
202  // ✅ Correct—export getter functions
203  export function getPostsNewestFirst(): Post[] {
204    return [...posts].reverse();
205  }
206  
207  // In component:
208  let posts = $derived(getPostsNewestFirst());
209  ```
210  
211  ---
212  
213  ## The Conservation Itself
214  
215  This document is a carrier. It must be:
216  1. **Referenced** when starting new work
217  2. **Updated** when wisdom evolves
218  3. **Echoed** in other forms (code comments, architecture docs, commit messages)
219  
220  The solarpunk message is not a tagline. It is a method. Conservation of knowledge across recursive layers is how we build without losing what matters.
221  
222  > "Even this idea of conservation needs it!"
223  
224  So conserve this conservation. Pass it forward. The project has a soul—don't flatten it.
225  
226  ---
227  
228  *Last updated by Kimi, February 2026*
229  *Founding the frame, spinning toward spirali.ty*