How literallyeverything22-ux/creativeos_layered_memory works
Purpose and Runtime Entry Points
CreativeOS is a local-first AI writing studio for developing shared franchise/IP knowledge. A React/Vite desktop-browser UI communicates with a Python backend, which uses local SQLite persistence and a locally running Ollama model. Startup is intended through run.bat; backend application entry is backend/main.py, and frontend bootstrap is frontend/src/main.tsx.
Client Application Shell
The frontend organizes the studio around a shared application state, sidebar navigation, and feature views for projects, documents, chat, and agent settings. frontend/src/App.tsx composes the application; frontend/src/modules/core/context/AppContext.tsx is the cross-view state boundary; frontend/src/modules/core/components/Sidebar.tsx selects workspace areas.
Project and Document Workspace
Project management and authoring are distinct UI workflows: dashboard/project creation establish the active creative workspace, while document views support browsing and editing its knowledge base. Core components are frontend/src/modules/project/components/DashboardView.tsx, frontend/src/modules/project/components/NewProjectModal.tsx, and frontend/src/modules/document/components/DocumentEditor.tsx. Backend resources are separated by backend/app/modules/project/router.py and backend/app/modules/document/router.py.
Canon and Knowledge Lifecycle
The central control boundary is document status: drafts may be edited and reviewed, but agents consume canon context unless a user explicitly pins other material. The backend’s data model and persistence layer are backend/app/core/models.py and backend/app/core/database.py. Canon source templates define the initial shared knowledge domains in Master_file templets/# PROJECT BIBLE.txt, Master_file templets/# WORLD CANON.txt, and related canon files.
AI Department Orchestration
Chat requests enter the agent layer, where routing selects one of six specialist departments—World, Character, Story, Screenplay, Producer, or Consistency—and assembles appropriate project context. This orchestration boundary is implemented in backend/app/modules/agent/router.py and backend/app/modules/agent/departments.py; user interaction is in frontend/src/modules/chat/components/ChatView.tsx and frontend/src/modules/chat/components/ChatInput.tsx.
Skills, Memory, and Model Boundary
Departments are constrained by versioned Markdown skill instructions rather than opaque private agent state. The active skill catalog is under backend/app/modules/agent/skills/, including story/story-structure-craft.SKILL.md and shared/master-file-protocol.SKILL.md. Shared memory and atom-level knowledge handling are represented by backend/app/modules/agent/memory.py and backend/app/modules/agent/memory_atoms.py. backend/app/core/llm.py is the adapter boundary to Ollama, expected to serve llama3:8b locally.
Approval, Inspection, and Export-Oriented Use
Agents propose changes; the user remains responsible for approval and canonization. The UI exposes agent/entity inspection through frontend/src/modules/agent/components/AgentSettingsModal.tsx and frontend/src/modules/agent/components/EntityBrowser.tsx. System-level API behavior is isolated in backend/app/modules/system/router.py; the architecture is designed to retain local, inspectable project data and enable document/project exports rather than cloud synchronization.
Components 21
Studio UI
- Frontend bootstrap
frontend/src/main.tsx - Application shell
frontend/src/App.tsx - Shared app state · Cross-view workspace state boundary.
frontend/src/modules/core/context/AppContext.tsx - Workspace navigation
frontend/src/modules/core/components/Sidebar.tsx - Project workspace · Creates and selects the active creative workspace.
frontend/src/modules/project/components/DashboardView.tsx - Document editor · Browses and edits project knowledge.
frontend/src/modules/document/components/DocumentEditor.tsx - Department chat · Sends user prompts to specialist agents.
frontend/src/modules/chat/components/ChatView.tsx - Agent & entity inspection · Supports review before approval and canonization.
frontend/src/modules/agent/components/EntityBrowser.tsx
Local Backend
- Backend application
backend/main.py - Project API
backend/app/modules/project/router.py - Document API · Enforces the draft and canon document lifecycle.
backend/app/modules/document/router.py - Agent orchestration · Routes requests and assembles project context.
backend/app/modules/agent/router.py - System API · Isolates system-level behavior.
backend/app/modules/system/router.py - Project persistence · Stores local projects, documents, statuses, and knowledge.
backend/app/core/database.py
Knowledge & AI
- Six AI departments · World, Character, Story, Screenplay, Producer, and Consistency specialists.
backend/app/modules/agent/departments.py - Versioned skill catalog · Explicit instructions constrain department behavior.
- Shared memory atoms · Manages shared memory and atom-level knowledge.
backend/app/modules/agent/memory_atoms.py - Canon source templates · Initial project bible and world canon domains.
Master_file templets/# PROJECT BIBLE.txt - Ollama adapter · Connects to the local llama3:8b model.
backend/app/core/llm.py - Local Ollama · Serves llama3:8b locally.
Other components
- Local startup · Starts the local studio stack.
run.bat
Connections 27
- Local startup → Frontend bootstrap: starts
- Local startup → Backend application: starts
- Frontend bootstrap → Application shell: mounts
- Application shell → Shared app state: provides
- Application shell → Workspace navigation: renders
- Workspace navigation → Project workspace: selects
- Workspace navigation → Document editor: selects
- Workspace navigation → Department chat: selects
- Shared app state → Project workspace: shares active project
- Shared app state → Document editor: shares active project
- Project workspace → Project API: manages projects
- Document editor → Document API: edits documents
- Department chat → Agent orchestration: sends prompts
- Agent & entity inspection → Agent orchestration: inspects proposals
- Backend application → Project API: serves
- Backend application → Document API: serves
- Backend application → Agent orchestration: serves
- Backend application → System API: serves
- Project API → Project persistence: reads and writes
- Document API → Project persistence: stores draft/canon status
- Canon source templates → Project persistence: seeds knowledge domains
- Agent orchestration → Six AI departments: routes requests
- Six AI departments → Versioned skill catalog: loads instructions
- Six AI departments → Shared memory atoms: uses context
- Project persistence → Shared memory atoms: provides canon context · Drafts require explicit pinning.
- Six AI departments → Ollama adapter: invokes
- Ollama adapter → Local Ollama: runs model