Commonplace Data and Response Objects
For version 2 of the protocol.
Core Domain Objects
Card
A Card
represents the complete, composed view of a card as exposed through the Commonplace Protocol. It combines information from multiple underlying storage objects to provide a unified interface for card operations.
Key Properties:
id
: Stable identifier for this card (persists across versions)name
: Display name of the cardtype_id
: The Card Type that defines this card's structure and behaviorversion
: Current version numberfields
: The card's field data organized by field namecreated_at
: When this card was originally createdupdated_at
: When this card was last modifiedtotal_size_bytes
: Total storage size of this card
Collection Context Properties:
reference_id
: Unique identifier for this card's placement in the collectioncollection_id
: Which collection this card appears inposition
: Spatial coordinates within the collection (x, y)display_overrides
: Collection-specific display customizationsreference_created_at
: When this card was added to the collection
Metadata Properties:
reference_count
: Total of references to this cardversion_count
: Total number of versions of this cardconnections
: Inter-card connections and relationships
Purpose: Card is the primary interface for all card operations in the protocol. It abstracts away the underlying storage decomposition while providing all information needed for display, editing, and manipulation.
Implementation Note: Cards are composed from multiple immutable storage objects but presented as a single coherent entity through the protocol.
Collection
A Collection
represents rich metadata about a collection container, equivalent to a collection summary. It contains descriptive information and aggregate statistics but does not include actual content identifiers.
Key Properties:
id
: Unique identifier for this collectionname
: Display name of the collectiondescription
: Optional description textcollection_type_id
: Reference to the CollectionType that defines this collection's behaviorcreated_at
: When this collection was createdupdated_at
: When this collection was last modified
Aggregate Properties:
total_card_count
: Total number of cards (including in nested collections)direct_card_count
: Number of cards directly in this collectionchild_collection_count
: Number of direct child collectionstotal_size_bytes
: Total storage size of all contentlast_accessed
: When this collection was last viewed or modified
Spatial Properties:
viewport_bounds
: Default viewing area for this collectionspatial_layout_type
: Type of spatial organization (grid, freeform, etc.)default_zoom_level
: Default zoom level for viewing this collection
Purpose: Collections provide rich metadata for organizational structure without carrying their actual contents, enabling efficient collection browsing and management.
CardType
A CardType
defines the schema, behavior, and presentation template for cards of a specific type.
Key Properties:
id
: Unique identifier for this card typename
: Human-readable name (e.g., "Note", "Task", "Person")description
: Description of this card type's purposeversion
: Version of this card type definitionstorage_schema_id
: Reference to the underlying storage schemacreated_at
: When this card type was defined
Schema Properties:
fields
: Field definitions with types, constraints, and validation rulesrequired_fields
: List of fields that must have valuesfield_defaults
: Default values for fields
Link Properties:
outlet
: Single output link point for this card typeinlets
: Array of input link points for this card type
Behavior Properties:
commonscript
: Optional script code for validation and behaviorui_template
: Template for rendering cards of this type
Purpose: CardTypes define the structure and behavior of cards, serving as templates for card creation and validation.
CollectionType
A CollectionType
defines the behavior, linking interface, and constraints for collections of a specific type.
Key Properties:
id
: Unique identifier for this collection typename
: Human-readable name (e.g., "Workspace", "Project", "Kanban Board")description
: Description of this collection type's purposeversion
: Version of this collection type definitioncreated_at
: When this collection type was defined
Link Properties:
outlet
: Single output link point for collections of this typeinlets
: Array of input link points for collections of this type
Behavior Properties:
commonscript
: Optional script code for collection-level validation and behaviorui_template
: Template for rendering collections of this type
Card Management Properties:
defined_card_types
: CardTypes that are defined by this collection typeallowed_card_types
: CardTypes that can be contained in collections of this typecard_type_constraints
: Rules about which card types can coexist
Purpose: CollectionTypes define the structure, behavior, and constraints for collections, enabling typed collection hierarchies and link management.
Outlet
Defines the output link point for a card type or collection type.
Key Properties:
name
: Identifier for this outlet (e.g., "output", "result")description
: Human-readable description of what this outlet providesdata_type
: Optional type specification for data flowing through this outlet
Inlet
Defines an input link point for a card type or collection type, with optional type constraints.
Key Properties:
name
: Identifier for this inlet (e.g., "input", "source", "trigger")description
: Human-readable description of what this inlet acceptsrequired
: Whether this inlet must be linked for the entity to functionaccepted_entity_types
: Optional list of CardType or CollectionType IDs that can link to this inletdata_type
: Optional type specification for data this inlet acceptsmultiple_links
: Whether this inlet can accept multiple simultaneous links
Purpose: Inlets define typed link points that enable cards and collections to receive data or triggers from other entities, with optional type safety through entity type constraints.
Link
A Link
represents a directed connection between two entities (cards or collections), enabling rich relationships and data flow within the Commonplace system.
Key Properties:
id
: Unique identifier for this linksource
: The entity that originates this linktarget
: The entity that receives this linklink_type
: Type of relationship (e.g., "references", "depends_on", "contains")parent_collection_id
: The collection containing both linked entities (peer constraint)created_at
: When this link was established
Link Properties:
source_outlet
: Named outlet point on the source entitytarget_inlet
: Named inlet point on the target entitybidirectional
: Whether this link operates in both directionsmetadata
: Additional key-value data about this relationship
Purpose: Links enable cards and collections to reference each other, creating networks of related information and enabling data flow between entities within the same collection context.
LinkEndpoint
Represents either end of a link, which can be either a card or a collection.
Endpoint Types:
Card
: Link endpoint is a cardcard_id
: Identifier of the cardreference_id
: Specific reference of the card within the collection
Collection
: Link endpoint is a collectioncollection_id
: Identifier of the collection
Purpose: LinkEndpoint provides type-safe representation of link connections between different entity types while maintaining clear entity identification.
CardProxy
A CardProxy
provides essential information about a card's placement within a collection, sufficient for rendering and interaction without including the full card data.
Key Properties:
reference_id
: Unique identifier for this card referencelogical_card_id
: Stable identifier for the underlying cardcard_name
: Display name of the cardschema_id
: Card type identifier (for icons, styling, behavior)
Spatial Properties:
position
: Coordinates within the collection (x, y)display_overrides
: Collection-specific display customizationsz_index
: Layering order for overlapping cards
Metadata Properties:
last_updated
: When this card was last modifiedtotal_size_bytes
: Storage size (for performance decisions)link_count
: Number of links involving this cardreference_created_at
: When this card was added to the collection
Purpose: CardReferenceProxy enables collection content rendering and interaction without requiring full card data, supporting efficient large-collection operations.
Standard Response Patterns
SuccessResponse
A standardized success response for operations that don't return specific data.
Key Properties:
success
: Always true for success responsesmessage
: Optional human-readable success messageoperation_id
: Optional identifier for tracking the operationtimestamp
: When the operation completed
ErrorResponse
A standardized error response providing detailed error information.
Key Properties:
success
: Always false for error responseserror_code
: Machine-readable error identifiererror_message
: Human-readable error descriptiondetails
: Optional additional error contextoperation_id
: Optional identifier for tracking the failed operation
CollectionContentsResponse
Response type for GetCollectionContents
operations, containing collection content without full card data.
Key Properties:
collection_id
: Which collection this response representscards
: Array of CardProxy objects (actually References under the hood)child_collections
: Array of Collection objects (full metadata)pagination_info
: Information about result pagination
Pagination Properties:
offset
: Starting position for offset-based paginationlimit
: Maximum number of items returnedtotal_count
: Total number of items availablespatial_bounds
: Viewport bounds for spatial querieshas_more
: Whether additional items are available
PaginatedResponse
Generic wrapper for paginated results of any content type.
Key Properties:
items
: Array of result items (type varies by operation)offset
: Starting position in the full result setlimit
: Maximum number of items in this responsetotal_count
: Total number of items available across all pageshas_more
: Whether additional pages are available
Server and Connection Types
ServerInfo
Information about the Commonplace server instance and its capabilities.
Key Properties:
server_name
: Human-readable server identifierserver_version
: Server software versionprotocol_version
: Supported protocol versionmax_message_size
: Maximum message size in bytescapabilities
: Server feature capabilities
ServerCapabilities
Detailed information about server features and limits.
Feature Flags:
supports_spatial_queries
: Whether spatial collection queries are supportedsupports_scripting
: Whether CommonScript execution is availablesupports_bulk_operations
: Whether bulk transaction operations are supportedsupports_real_time_sync
: Whether real-time synchronization is available
Limits:
max_card_size_bytes
: Maximum size for individual cardsmax_collection_depth
: Maximum nesting depth for collectionsmax_cards_per_collection
: Maximum cards allowed in a single collectionquery_timeout_seconds
: Maximum time allowed for query operations
ConnectionInfo
Information about the current client connection.
Key Properties:
connection_id
: Unique identifier for this connectionclient_address
: Client IP address and portconnected_at
: When this connection was establishedlast_activity
: Timestamp of last message receivedsession_id
: Associated session identifier (if authenticated)
SessionInfo
Information about the authenticated session.
Key Properties:
session_id
: Unique session identifieruser_id
: Authenticated user identifiercontainer_id
: Primary container for this sessioncreated_at
: When this session was createdexpires_at
: When this session expirespermissions
: Access control permissions for this session
Query and Filter Types
CardQuery
Query specification for finding cards within collections.
Key Properties:
collection_id
: Which collection to search insearch_scope
: How deeply to search in collection hierarchyschema_ids
: Optional list of card types to includefield_filters
: Filters on specific field valuestext_search
: Full-text search across card contentspatial_bounds
: Spatial area to search withindate_range
: Filter by creation or modification date
Result Control:
sort_criteria
: How to order resultslimit
: Maximum number of results to returnoffset
: Starting position for pagination
CollectionQuery
Query specification for finding collections.
Key Properties:
parent_collection_id
: Parent collection to search withinsearch_scope
: How deeply to search in collection hierarchyname_pattern
: Pattern matching for collection namescollection_types
: Types of collections to includesize_range
: Filter by card count or storage sizedate_range
: Filter by creation or modification date
SpatialQuery
Query specification for spatial operations within collections.
Key Properties:
bounds
: Rectangular area to query (x, y, width, height)zoom_level
: Level of detail for the queryinclude_partially_visible
: Whether to include items partially within boundssort_by_distance
: Whether to sort results by distance from center
Advanced Properties:
link_filter
: Filter by link relationshipsclustering_level
: Level of spatial clustering to apply
FilterCriteria
Generic filter specification for field-based filtering.
Field Filters:
field_name
: Name of field to filter onoperator
: Comparison operator (equals, contains, greater_than, etc.)value
: Value to compare againstcase_sensitive
: Whether text comparisons are case-sensitive
Logical Operators:
and_filters
: All conditions must matchor_filters
: Any condition can matchnot_filters
: Conditions that must not match
SortCriteria
Specification for result ordering.
Key Properties:
field_name
: Field to sort bydirection
: Ascending or descending ordernull_handling
: How to handle null/missing valuessecondary_sort
: Additional sort criteria for tie-breaking
Special Sort Types:
spatial_distance
: Sort by distance from a pointrelevance_score
: Sort by search relevance (for text queries)connection_count
: Sort by number of linkslast_accessed
: Sort by recent activity
SearchScope
Defines how deeply to search within collection hierarchies.
Scope Types:
DirectOnly
: Search only the specified collection, no child collectionsRecursive
: Search the collection and all descendant collections (full tree)OneLevel
: Search the collection and immediate child collections onlyMaxDepth(u32)
: Search to a specific depth level from the starting collection
Purpose: SearchScope provides precise control over hierarchical search operations, enabling both performance optimization and specific search patterns for different use cases.
Field Types and Constraints
FieldValue
A FieldValue
represents the actual data stored in a card field, with strong typing to ensure data integrity.
Supported Types:
Text
: String data with optional constraints- 'StyledText': String data representing rich text with formatting and styling (eg markdown)
Number
: Numeric data (f64) with optional range constraints- 'Image': JPG, GIF, PNG images in binary
- 'PDF': PDF documents in binary
- 'Audio': Audio files in binary
- 'Video': Video files in binary
- 'Icon': Commonplace Vector Icon
- 'File': Generic file uploads in binary
Boolean
: True/false valuesDate
: ISO 8601 formatted date/time stringsCardReference
: References to other cards by IDList
: Arrays of other FieldValuesObject
: Nested key-value structures- 'Commonscript': Text representing Commonscript
Extension
: Custom binary data with schema versioning
Purpose: FieldValues provide type-safe storage for all card content while supporting both simple and complex data structures.
FieldConstraints
Field constraints define validation rules and limits for field values.
Text Constraints:
min_length
/max_length
: Character count limitspattern
: Regular expression validationallowed_values
: Enumerated list of valid values
Number Constraints:
min_value
/max_value
: Numeric range limitsstep
: Required increment/decrement valueprecision
: Decimal place precision
General Constraints:
required
: Whether field must have a valueunique
: Whether field value must be unique within collectionindexed
: Whether field should be indexed for fast queries
FieldType
Field type definitions specify the structure and constraints for card fields.
Core Properties:
name
: Field identifierfield_type
: The data type (Text, Number, Boolean, etc.)required
: Whether this field must have a valueconstraints
: Type-specific validation rulesdefault_value
: Default value for new cards
Advanced Properties:
indexed
: Whether to create search indexescomputed
: Whether value is calculated from other fields
ValidationRules
Validation rules define complex constraints that span multiple fields or require custom logic.
Rule Types:
field_dependency
: Rules about required field combinationsconditional_required
: Fields required based on other field valuescross_field_validation
: Rules comparing multiple field valuescustom_script
: CommonScript code for complex validation
Rule Structure:
rule_id
: Unique identifier for this ruledescription
: Human-readable rule descriptionseverity
: Error, Warning, or Info leveltrigger_conditions
: When this rule should be evaluated
Metadata Types
Timestamps
Standardized timestamp information used throughout the system.
Key Properties:
created_at
: When the object was originally created (Unix timestamp)updated_at
: When the object was last modified (Unix timestamp)accessed_at
: When the object was last accessed (Unix timestamp)expires_at
: Optional expiration timestamp
Format: All timestamps are Unix timestamps (seconds since epoch) for consistency and timezone neutrality.
VersionInfo
Information about object versioning and change history.
Key Properties:
current_version
: Current version numberversion_count
: Total number of versionslast_modified_at
: When the current version was createdlast_modifier
: Identifier of who made the last changechange_summary
: Brief description of the most recent change
History Properties:
previous_version
: Version number of the previous versionchange_type
: Type of change (create, update, migrate, etc.)migration_info
: Information about schema migrations (if applicable)
ReferenceMetadata
Metadata specific to card references within collections.
Key Properties:
reference_id
: Unique identifier for this referencecollection_id
: Which collection contains this referencereference_created_at
: When this reference was createdreference_updated_at
: When reference metadata was last changedposition_history
: Track of position changes over time
Display Properties:
custom_title
: Collection-specific title overridecustom_color
: Collection-specific color overridevisibility
: Normal, minimized, or hidden statuslocal_tags
: Collection-specific tags or labels
CollectionMetadata
Extended metadata for collections beyond basic properties.
Key Properties:
collection_type
: Optional type classifier for collectionslayout_preferences
: Default layout and viewing preferencesaccess_patterns
: Usage statistics and optimization hintsbackup_info
: Information about backups and snapshots
Performance Metadata:
cache_priority
: Hint for memory managementindex_status
: Status of search indexes for this collectioncompaction_info
: Information about storage optimizationquery_statistics
: Performance data for query optimization
Identifier Types
UUID
All identifiers in the Commonplace system use RFC 4122 UUIDs for global uniqueness and collision resistance.
Properties:
- Format: 128-bit UUID in standard hyphenated string format
- Version: UUID version 4 (random) for most identifiers
- Uniqueness: Globally unique across all Commonplace instances
- Immutability: UUIDs never change once assigned
Usage: UUIDs are used for all primary identifiers (cards, collections, references, etc.) to support distributed operation and data migration.
CollectionId
Strongly-typed UUID specifically for collection identification.
Purpose: Identifies collections uniquely across the system, supporting hierarchical organization and cross-references.
CardId
Strongly-typed UUID for card identification, with distinction between logical and instance IDs.
Types:
logical_card_id
: Stable identifier across all versions of a cardinstance_id
: Specific to individual card versionsreference_id
: Specific to card placement within collections
Usage: Different ID types enable proper handling of card versioning, references, and collection placement.
CardTypeId
Strongly-typed UUID for card type/schema identification.
Purpose: Identifies card type definitions, enabling proper validation, rendering, and behavior for cards of specific types.
CollectionTypeId
Strongly-typed UUID for collection type/schema identification.
Purpose: Identifies collection type definitions, enabling proper validation, rendering, and behavior for collections of specific types.
Error and Status Types
ErrorCode
Machine-readable error codes for consistent error handling across clients.
Connection Errors:
INVALID_PROTOCOL_VERSION
: Unsupported protocol versionCONNECTION_REFUSED
: Server rejected connectionAUTHENTICATION_FAILED
: Invalid credentials or expired sessionSESSION_EXPIRED
: Session timeout or invalidation
Request Errors:
INVALID_MESSAGE_FORMAT
: Malformed message structureUNKNOWN_MESSAGE_TYPE
: Unsupported message typeMESSAGE_TOO_LARGE
: Message exceeds size limitsRATE_LIMIT_EXCEEDED
: Too many requests from client
Data Errors:
CARD_NOT_FOUND
: Requested card does not existCOLLECTION_NOT_FOUND
: Requested collection does not existPERMISSION_DENIED
: Insufficient permissions for operationVALIDATION_FAILED
: Data validation errorsSCHEMA_MISMATCH
: Card data doesn't match expected schema
Server Errors:
INTERNAL_ERROR
: Unexpected server errorSERVICE_UNAVAILABLE
: Server temporarily unavailableSTORAGE_ERROR
: Persistent storage failureCAPACITY_EXCEEDED
: Server resource limits exceeded
ValidationError
Detailed validation error information for data submission failures.
Key Properties:
field_name
: Which field failed validationerror_type
: Type of validation failureerror_message
: Human-readable error descriptionexpected_value
: What value was expected (if applicable)actual_value
: What value was provided
Error Types:
REQUIRED_FIELD_MISSING
: Required field not providedINVALID_FORMAT
: Field format doesn't match constraintsVALUE_OUT_OF_RANGE
: Numeric value outside allowed rangeREFERENCE_NOT_FOUND
: Referenced object doesn't existCONSTRAINT_VIOLATION
: Custom validation rule failed
OperationStatus
Status information for long-running or complex operations.
Key Properties:
operation_id
: Unique identifier for tracking the operationstatus
: Current status (pending, in_progress, completed, failed)progress_percent
: Completion percentage (0-100)estimated_completion
: Estimated completion timestatus_message
: Current status description
Status Values:
PENDING
: Operation queued but not yet startedIN_PROGRESS
: Operation currently executingCOMPLETED
: Operation finished successfullyFAILED
: Operation failed with errorsCANCELLED
: Operation was cancelled by user or system
ServerError
Detailed server error information for debugging and monitoring.
Key Properties:
error_id
: Unique identifier for this error occurrenceerror_code
: Machine-readable error classificationerror_message
: Human-readable error descriptiontimestamp
: When the error occurredcontext
: Additional context about the error
Debug Information:
request_id
: Associated request identifieruser_id
: User associated with the error (if applicable)stack_trace
: Server-side stack trace (in development mode)recovery_suggestions
: Possible solutions or next steps