Core API
About file generation for Continuity projects.
This module provides backward compatibility import for AboutGenerator. The implementation has been moved to the generators submodule.
- class continuity.core.about.AboutGenerator(project_path)[source]
Generates ABOUT.md files from templates and changelog entries.
Constants for Continuity core functionality.
This module centralizes hardcoded values to make the system more maintainable.
Simple file processing for Continuity inbox. Phase 3: Simplified to handle only basic markdown file processing.
- class continuity.core.file_processor.SimpleFileProcessor(base_path, config)[source]
Simple file processor that handles markdown files only.
- detect_recipient(content)[source]
Detect recipient from content (simple @mention detection).
- Return type:
Inbox functionality for Continuity.
Provides automatic processing of files dropped into the inbox directory, adding metadata and moving them to the appropriate mailbox.
- class continuity.core.inbox.InboxProcessor(base_path, config)[source]
Processes files dropped into the inbox directory.
Simple project initialization functionality for Continuity. Phase 3: Simplified to remove complex knowledge base and advanced features.
- class continuity.core.init.ProjectInitializer(project_path, config)[source]
Handles project initialization and setup.
- detect_human_user()[source]
Detect a sensible human username.
- Return type:
- Returns:
Username string
- create_cli_reference()[source]
Create the CLI reference file.
- Return type:
- Returns:
Path to created CLI reference
- create_ai_agent_reference()[source]
Create or update the AI Agent Reference file.
- Return type:
- Returns:
Path to created/updated AI Agent Reference
- create_about_file()[source]
Create or update the ABOUT.md file.
- Return type:
- Returns:
Path to created/updated ABOUT.md file
- create_gitignore_entry()[source]
Add continuity directory to .gitignore if it exists.
- Return type:
- Returns:
True if .gitignore was updated, False otherwise
Core mailbox functionality for Continuity.
This module provides the main business logic for managing asynchronous messages between humans and AI assistants. It handles message storage, retrieval, and organization using various storage backends.
The module contains the core classes for message handling:
- Message: Represents individual messages with metadata
- MailboxManager: High-level mailbox operations
Example
Basic usage:
from continuity.core.mailbox import MailboxManager, Message
from continuity.config.base import ContinuityConfig
config = ContinuityConfig.load()
manager = MailboxManager(config)
# Create and send a message
message = Message(
id="msg-001",
content="Hello AI assistant!",
timestamp=datetime.now(),
sender="human_user",
recipient="ai_user"
)
success = manager.send_message(message)
- class continuity.core.mailbox.Message(id, content, timestamp, sender, recipient, read=False, title='', metadata=None)[source]
Represents a message in the async mailbox system.
A Message encapsulates all the information needed for asynchronous communication between humans and AI assistants. Messages support rich metadata, read/unread status tracking, and serialization.
- Parameters:
id (
str) – Unique identifier for the messagecontent (
str) – The main message content (supports Markdown)timestamp (
datetime) – When the message was createdsender (
str) – Username of the message senderrecipient (
str) – Username of the message recipientread (
bool) – Whether the message has been read (defaults to False)title (
str) – Optional message title (extracted from content if not provided)metadata (
Optional[Dict[str,Any]]) – Optional dictionary of additional metadata
- timestamp
Creation timestamp
- Type:
datetime
Example
Creating a simple message:
message = Message( id="msg-001", content="Hello Ada! How are you?", timestamp=datetime.now(), sender="human", recipient="agent" )
Creating a message with metadata:
message = Message( id="msg-002", content="Please review the API design", timestamp=datetime.now(), sender="human_user", recipient="ai_user", title="API Review Request", metadata={ "priority": "high", "project": "continuity", "tags": ["api", "review"] } )
- to_dict()[source]
Serialize message to dictionary format.
Converts the message object to a dictionary suitable for JSON serialization or storage. The timestamp is converted to ISO format.
- Return type:
- Returns:
Dictionary containing all message fields with JSON-serializable values.
Example
>>> message = Message(id="test", content="Hello", ...) >>> data = message.to_dict() >>> print(data['timestamp']) '2023-06-17T12:00:00'
- classmethod from_file(filepath)[source]
Load message from file with frontmatter parsing.
Reads a message from a markdown file with YAML frontmatter. The frontmatter can contain metadata like sender, recipient, title, etc. If no title is provided in frontmatter, it will be extracted from the first heading in the content or derived from the filename.
- Parameters:
filepath (
Path) – Path to the message file to load- Return type:
- Returns:
Message object parsed from the file
- Raises:
FileNotFoundError – If the specified file doesn’t exist
PermissionError – If the file cannot be read
Example
File structure:
--- from: human to: agent priority: high --- # API Review Request Please review the new API design...
Loading the message:
>>> message = Message.from_file(Path("api-review.md")) >>> print(message.sender) 'michael' >>> print(message.title) 'API Review Request'
- class continuity.core.mailbox.MailboxManager(base_path, config)[source]
Core mailbox functionality.
- get_message_by_id(user, message_id)[source]
Get a specific message by ID from unread, read, and archive folders.
- send_message(content, to=None, from_user=None, title='')[source]
Send a message to a mailbox.
- Return type:
- mark_unread(user, message_id)[source]
Mark a message as unread by moving it back from read folder.
- Return type:
- archive_message(user, message_id, from_read=False)[source]
Archive a message by moving it to archive folder.
- Return type:
- class continuity.core.mailbox.ContinuityCore(base_path, config)[source]
Core Continuity functionality.
- get_status(max_messages=5, timeout_seconds=10)[source]
Get overall continuity status with safety limits.
Notification system for tracking new activity across threads and mailboxes.
This module implements the pull notification system for Continuity, providing gentle awareness of new activity without interruption.
- class continuity.core.notifications.NotificationState(project_path, config=None)[source]
Manages notification state for tracking new activity.
- class continuity.core.notifications.ActivityDetector(notification_state)[source]
Detects new activity in threads and mailboxes.
Schema management for Continuity project structure.