How geodes-sms/lowkey works
1. Overall shape
- This repository is a Python framework for collaborative modeling, split into a reusable core under lowkey/ and a concrete example application under lowkey-examples/mindmap/.
- The core is layered from high-level modeling abstractions down to CRDT primitives and then to network transport.
2. Top-level architectural layers
- lowkey/collabtypes: the collaborative metamodeling layer.
- lowkey/lww: the conflict-free replicated data type layer.
- lowkey/network: distributed client/server synchronization over ZeroMQ.
- lowkey/collabapi: a command-oriented API that translates textual modeling operations into session actions.
- lowkey-examples/mindmap: a sample domain built on top of the framework.
3. CRDT subsystem: lowkey/lww
- This is the lowest state-management layer and implements last-write-wins data structures: register, set, map, graph, vertex, and edge.
- These types provide the convergence semantics that make replication safe across peers.
- The tests here focus on cloning, embedding, graph behavior, and multi-user register semantics, which suggests this layer is the conflict-resolution boundary of the system.
4. Collaborative modeling type system: lowkey/collabtypes
- This layer models collaborative entities such as Entity, Clabject, Association, Node, Model, Clock, and literal values.
- It bridges modeling concepts to the underlying CRDT storage and replication semantics.
- This is the architectural boundary where domain modeling constructs become distributed, versioned objects.
5. Command/API layer: lowkey/collabapi
- The API accepts modeling commands and parses them into structured operations.
- Commands include creating clabjects, creating associations, and updating entities.
- Session is the execution boundary here: parsed commands are applied against a session state rather than directly manipulating raw data structures.
6. Network subsystem: lowkey/network
- This package connects collaborators over the network using ZeroMQ.
- Client, Server, Memory, and LWWSession indicate a replicated session architecture where state updates are exchanged and stored.
- The README’s ZeroMQ references and “republishing updates from clients” note imply a pub-sub style with update redistribution, not a centralized database backend.
7. Data flow across layers
- User or test input enters as a command string or domain operation.
- The parser in collabapi converts it to a command object.
- The session applies the command to collaborative types.
- Those types persist and resolve conflicts using LWW CRDTs.
- In networked mode, the session’s updates are sent through the client/server layer and propagated to other peers.
8. Example application: lowkey-examples/mindmap
- The mindmap example is a full client of the framework, showing how to define a domain metamodel, parser/editor, scenario setup, and tests.
- It contains its own metamodel/, editor/, scenarios/, and tests/ packages, which makes it a good reference for how an application is expected to sit on top of the core layers.
- This example is likely the best place to infer how a real domain maps onto collaborative modeling primitives.
9. Mindmap domain structure
- The mindmap metamodel defines MindMap, Topic, CentralTopic, MainTopic, SubTopic, and Marker.
- These entities show how domain concepts are represented as model elements rather than application-specific records.
- The presence of a factory and package module indicates the domain is modeled declaratively and then instantiated through framework-provided mechanisms.
10. Mindmap editor and commands
- editor/DSLParser.py, Editor.py, and MindmapSession.py form a thin application-specific interaction layer.
- commands/ReadCommand.py and ReadObjectsCommand.py suggest the editor supports query/read operations in addition to structural editing.
- This layer sits above the core command/session APIs and adapts a human-facing DSL to the framework.
11. Scenarios and testing
- scenarios/BuildMindmapScenario.py provides a scripted setup for a sample model state, which is useful for demos or regression setups.
- Test suites exist separately for the CRDT layer, the collaborative type system, the network layer, the command API, and the example app.
- That separation reflects the architecture: each subsystem is intended to be testable in isolation.
12. Key architectural boundaries
- The main boundary is between domain logic and replication mechanics: mindmap or other models live above collabtypes, while consistency and transport live below it.
- Another boundary is between local state manipulation and distributed synchronization: Session/LWWSession hide replication details from the application layer.
- The command DSL provides a stable interface so the example app does not need to know CRDT or network details.
13. Technology and runtime notes
- The project is Python-based and packaged with setup.py.
- ZeroMQ is the material external transport dependency.
- CI is run via GitHub Actions and historically Travis, but those are build concerns rather than runtime architecture.
14. What an architecture diagram should emphasize
- Show a vertical stack: DSL/Editor or application commands at the top, collaborative modeling types in the middle, LWW CRDTs beneath, and network replication at the bottom.
- Show the mindmap example as a consumer of the core framework, not part of the framework itself.
- Represent the server/client path as an update propagation loop around the session state, with CRDTs ensuring convergence across replicas.
Main entry points: Entity.py Entity Model · Command.py Command · Session.py Session · LWWGraph.py LWW Graph
Components 30
Core framework
Reusable collaborative modeling stack
- API Parser · Turns text commands into structured operations
lowkey/collabapi/Parser.py - Session · Applies commands to collaborative state
lowkey/collabapi/Session.py - Command · Base command abstraction
lowkey/collabapi/commands/Command.py - Create Clabject · Builds collaborative model elements
lowkey/collabapi/commands/CreateClabjectCommand.py - Create Assoc · Builds relationships between entities
lowkey/collabapi/commands/CreateAssociationCommand.py - Update · Applies edits to existing entities
lowkey/collabapi/commands/UpdateCommand.py - Entity Model · Core collaborative entity abstractions
lowkey/collabtypes/Entity.py - Clabject · Typed model element abstraction
lowkey/collabtypes/Clabject.py - Association · Links entities within a model
lowkey/collabtypes/Association.py - Model Clock · Tracks collaborative version state
lowkey/collabtypes/Clock.py - Literals · Scalar and literal value support
lowkey/collabtypes/Literals.py - LWW Register · Last-write-wins register primitive
lowkey/lww/LWWRegister.py - LWW Set · Convergent set primitive
lowkey/lww/LWWSet.py - LWW Map · Convergent map primitive
lowkey/lww/LWWMap.py - LWW Graph · Replicated graph container
lowkey/lww/LWWGraph.py - Vertex · Graph vertex state
lowkey/lww/LWWVertex.py - Edge · Graph edge state
lowkey/lww/LWWEdge.py - Client · Sends local updates to peers
lowkey/network/Client.py - Server · Receives and republishes updates
lowkey/network/Server.py - Memory · In-memory replicated state store
lowkey/network/Memory.py - LWW Session · Session bridge for networked collaboration
lowkey/network/LWWSession.py
Mindmap example
Concrete application built on the framework
- DSL Parser · Mindmap-specific textual editor parser
lowkey-examples/mindmap/editor/DSLParser.py - Editor · Application editing façade
lowkey-examples/mindmap/editor/Editor.py - Mindmap Session · App session wiring for mindmap actions
lowkey-examples/mindmap/editor/MindmapSession.py - Factory · Creates mindmap model instances
lowkey-examples/mindmap/metamodel/MindMapFactory.py - Package · Declares the mindmap metamodel
lowkey-examples/mindmap/metamodel/MindMapPackage.py - MindMap Model · Top-level mindmap domain object
lowkey-examples/mindmap/metamodel/entities/MindMapModel.py - Topics · Mindmap topic hierarchy
lowkey-examples/mindmap/metamodel/entities/Topic.py - Marker · Topic annotation or tag
lowkey-examples/mindmap/metamodel/entities/Marker.py - Build Scenario · Scripted mindmap setup
lowkey-examples/mindmap/scenarios/BuildMindmapScenario.py
Connections 28
- API Parser → Session: creates actions · Parsed text is executed by a session
- Command → Create Clabject: specializes · Concrete command type
- Command → Create Assoc: specializes · Concrete command type
- Command → Update: specializes · Concrete command type
- Session → Entity Model: applies to · Session mutates collaborative entities
- Session → Command: executes · Consumes parsed commands
- Entity Model → Clabject: includes · Core modeling abstraction
- Entity Model → Association: includes · Core modeling abstraction
- Entity Model → Model Clock: tracks · Versioning and collaboration state
- Entity Model → Literals: uses · Value representation
- Clabject → LWW Map: persists in · Backed by CRDT storage
- Association → LWW Graph: persists in · Relationship state stored as graph
- LWW Graph → Vertex: composes · Graph internals
- LWW Graph → Edge: composes · Graph internals
- LWW Map → LWW Register: uses · Map entries rely on register semantics
- LWW Set → LWW Register: uses · Set membership resolves via register semantics
- Client → Server: syncs · Client/server update exchange
- Server → Memory: stores · Server keeps replicated state in memory
- LWW Session → Client: wraps · Network session sends local updates
- LWW Session → LWW Graph: replicates · Session bridges network and CRDT state
- DSL Parser → Editor: feeds · DSL input drives editor actions
- Editor → Mindmap Session: uses · Editor delegates to app session
- Mindmap Session → Session: extends · Application session builds on core API session
- Factory → Package: declares · Factory follows metamodel package
- MindMap Model → Topics: contains · Mindmap structure
- Topics → Marker: annotates · Topics can carry markers
- Build Scenario → MindMap Model: creates · Scenario assembles example state
- Build Scenario → Editor: drives · Scenario can exercise editor flows