Skip to content

Contexts (V1)

Contexts are the fundamental unit of knowledge storage in Contox's original (V1) system. Each context is a named container that holds project knowledge as either a single markdown document or a series of append-only journal entries.

Note: The V2 system (Memory Items) is now the primary knowledge system. V1 contexts remain fully supported and are used by the MCP server's context management tools. See Memory Items for the V2 approach.

Data Model

FieldTypeConstraintsDescription
namestring1--100 charactersDisplay name of the context
descriptionstringmax 500 characters, optionalBrief summary of what this context contains
contentstringmax 50,000 charactersThe markdown content (content-based storage)
schemaKeystringoptionalHierarchical taxonomy key (e.g., root/frontend/hooks)
tierinteger1, 2, or 3Controls brain inclusion priority
stateenumdraft | approved | deprecatedLifecycle state
contextTypeenumsystem | reference | memoryClassification of the context's origin
parentContextIdstringoptionalParent context ID for hierarchy

Storage Models

Contexts support two distinct storage models:

Content-Based Storage

A single markdown document stored in the content field. Best suited for:

  • Architecture overviews
  • Convention documents
  • Design decision records
  • Static reference material

Content is replaced on update (not appended). The maximum content size is 50,000 characters.

Entries-Based Storage

An append-only journal where each entry has its own title, content, tags, and metadata. Best suited for:

  • Implementation journals
  • Bug fix logs
  • Session summaries
  • Any chronological record

Entries are never overwritten -- new entries are always appended. Each entry can include:

FieldDescription
titleShort description of the entry (max 200 characters)
contentFull markdown content of the entry
entryTypeClassification (e.g., bug-fix, feature, session)
tagsArray of categorization tags
sourceOrigin identifier (e.g., cli-scan, mcp-server)
sourceRefReference back to the source (e.g., commit SHA)

Context Types

The contextType field classifies how the context was created and how it should be treated:

TypeDescriptionTypical Source
systemCore project configuration and structureCreated by the system during project setup
referenceStable knowledge unlikely to change frequentlyPopulated via contox scan or manual entry
memorySession-derived knowledge that evolves over timeCreated by contox_save_session or auto-save

Hierarchical Organization

Contexts can be organized into a tree structure using parentContextId. This enables:

  • Grouping related contexts under a common parent
  • Nested navigation in the dashboard
  • Scoped searches within a subtree

For example, a project might organize contexts as:

Project Memory (root)
  +-- Architecture
  |     +-- Frontend Architecture
  |     +-- Backend Architecture
  +-- Conventions
  |     +-- Code Style
  |     +-- Git Workflow
  +-- Implementation Journal

State Machine

Every context follows a three-state lifecycle:

mermaid
stateDiagram-v2
    [*] --> draft : Created
    draft --> approved : Approve
    approved --> deprecated : Deprecate
    deprecated --> approved : Re-approve

States

StateDescriptionBrain Inclusion
draftNewly created, not yet reviewedExcluded from brain
approvedReviewed and accepted as valid knowledgeIncluded in brain
deprecatedOutdated or superseded by newer informationExcluded from brain

Only approved contexts are included when assembling the brain document. Draft contexts are visible in the dashboard but do not affect the brain output. Deprecated contexts are hidden by default but can be found via search.

Tier System

The tier field controls how eagerly a context is loaded into the brain:

TierStrategyUse Case
1Always loadedCritical conventions, key decisions, active bugs
2Loaded on demandReference material, stable architecture docs
3ArchivedHistorical entries, resolved bugs, old journal entries

Tiers map directly to the brain's layer system. See Brain Assembly for details on how tiers affect the assembled document.