Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.compose.market/llms.txt

Use this file to discover all available pages before exploring further.

Memory operations keep the retrieval corpus small enough to search and explicit enough to repair. The implementation lives in operations.ts, jobs.ts, items.ts, and runtime/src/temporal/memory.

Job types

runMemoryMaintenanceJob() supports five job types.
TypeRequired scopeBehavior
consolidateagentWallets or agentWalletMarks duplicate content/source rows as metadata.status: "superseded" and lowers their decayScore to at most 0.05.
patterns_extractagentWalletReads transcripts in a time window and extracts repeated tool-call sequences.
archive_createagentWalletCreates a compressed archive from vector rows in a date range.
decay_updateNoneRecomputes vector decayScore with the requested half-life.
cleanupNoneDeletes stale low-decay vectors, expired sessions, and old transcripts.
Jobs are stored in memory_jobs with running, completed, or failed status.

Inline and Temporal execution

The low-level jobs.ts runner executes maintenance inline. The Temporal service runs the same jobs through Temporal when execution: "temporal" is requested and Temporal is configured.
ExecutionRuntime behavior
inlineRuns in the runtime process and writes one memory_jobs record.
temporalStarts a Temporal workflow, stores workflow ids on the job record, and refreshes state from Temporal queries.
Temporal memory workflows send heartbeats, retry activities, support pause/resume signals, and continue-as-new during long consolidation batches.

Schedules

Memory schedules are managed through /api/memory/schedules.
ScheduleFrequencyWorkflow
Daily consolidationMEMORY_DAILY_CONSOLIDATION_CRONmemoryConsolidationWorkflow
Daily pattern extraction per agentMEMORY_DAILY_CONSOLIDATION_CRONpatternExtractionWorkflow
Weekly archive per agentMEMORY_WEEKLY_ARCHIVE_CRONarchiveCreationWorkflow
Hourly decayMEMORY_HOURLY_DECAY_CRONdecayUpdateWorkflow
Daily cleanupMEMORY_DAILY_CONSOLIDATION_CRONmemoryCleanupWorkflow
The default overlap policy is SKIP, except weekly per-agent archives use BUFFER_ONE.

Pattern extraction

extractExecutionPatterns() reads session_transcripts, extracts tool-call names, groups identical sequences, and stores frequent sequences as tool_sequence patterns.
{
  "patternType": "tool_sequence",
  "trigger": {
    "type": "context",
    "value": "search_call"
  },
  "steps": [
    { "action": "search_call", "order": 0 },
    { "action": "models_call", "order": 1 }
  ],
  "successRate": 0.65,
  "executionCount": 3
}
The runtime can validate a pattern and promote it into a skills document. Promotion creates a learned skill with a pattern trigger, the extracted tool list, and success metadata.

Archives

createMemoryArchive() serializes selected vector rows into a JSON payload, compresses the payload with gzip by default, and stores it in archives. Archive rows contain:
FieldMeaning
archiveIdRuntime-generated archive id.
agentWalletAgent scope.
dateRangeSource vector range.
contentJSON payload or gzip base64 payload.
compressedWhether gzip compression was used.
metadata.entryCountNumber of vector rows included.
ipfsCidOptional Pinata IPFS CID after sync.
syncArchiveToPinata() accepts PINATA_JWT or PINATA_API_KEY plus PINATA_API_SECRET.

Item lifecycle

The item APIs work against memory collection rows.
OperationBehavior
getMemoryItem()Reads an active row by vectorId and optional scope.
updateMemoryItem()Updates content, metadata, retention, confidence, or status. Re-embeds when content changes.
deleteMemoryItem()Soft-deletes by setting metadata.status: "deleted" and decayScore: 0; hardDelete removes the row.
resolveMemoryConflict()Records conflict metadata and can mark a row superseded.
Soft-deleted and superseded rows are excluded by active-layer filters. Hard deletes remove the row permanently.

Cleanup

cleanupExpiredMemories() deletes:
DataCondition
VectorscreatedAt older than the cutoff, decayScore < 0.2, and metadata.retention != "pinned".
SessionsexpiresAt in the past or lastAccessedAt older than the cutoff.
TranscriptscreatedAt older than the cutoff.
After cleanup, the runtime invalidates memory caches globally.

Endpoint map

FamilyRoutes
LoopPOST /api/memory/context/assemble, POST /api/memory/turns/record, POST /api/memory/remember, POST /api/memory/loop
ManifestsGET /api/memory/workflows, GET /api/memory/workflows/{workflowId}
Patterns and skillsGET /api/memory/patterns, GET /api/memory/patterns/{patternId}, POST /api/memory/patterns/{patternId}/validate, POST /api/memory/patterns/{patternId}/promote, GET /api/memory/skills, GET /api/memory/skills/{skillId}
Sessions and archivesPOST /api/memory/transcripts/index, GET/PATCH /api/memory/sessions/{sessionId}/working, POST /api/memory/sessions/{sessionId}/compress, POST /api/memory/archives/{archiveId}/sync
SchedulesGET/POST/DELETE /api/memory/schedules, POST /api/memory/schedules/{scheduleId}/pause, resume, trigger
ItemsPOST /api/memory/items/search, GET/PATCH/DELETE /api/memory/items/{id}, POST /api/memory/conflicts/{id}/resolve
Jobs and evalsPOST /api/memory/jobs, GET /api/memory/jobs/{jobId}, POST /api/memory/evals/runs
CompatibilityPOST /api/memory/add, POST /api/memory/search, GET /api/memory/{agentWallet}, POST /api/memory/vector-search, POST /api/memory/vector-index, POST /api/memory/transcript-store, GET /api/memory/transcript-get/{id}, POST /api/memory/rerank, POST /api/memory/layers/search