Skip to main content
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. 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. 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. 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.
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: syncArchiveToPinata() accepts PINATA_JWT or PINATA_API_KEY plus PINATA_API_SECRET.

Item lifecycle

The item APIs work against memory collection rows. Soft-deleted and superseded rows are excluded by active-layer filters. Hard deletes remove the row permanently.

Cleanup

cleanupExpiredMemories() deletes: After cleanup, the runtime invalidates memory caches globally.

Endpoint map