Skip to main content

Context Memory in Genum

Memory isn't just storage — it's dynamic context injection that extends prompt logic intelligently.

In Genum, the Memory Layer allows prompts to be extended with contextual data at runtime. This makes your prompts adaptive, state-aware, and capable of dynamic behavior based on business-specific inputs.


What is a Memory Key?

A Memory Key is a user-defined key-value pair that acts as a named extension to a prompt. It works like this:

  • The key is a unique business identifier (e.g., key=acme_corp).
  • The value is a structured or textual extension that will be injected into the prompt at runtime.

Memory Keys are defined at the prompt level and can be stored, managed, and reused across executions.


How Memory Is Applied

When executing a prompt, you can pass a memoryKey through the Genum API or Playground. If the key is recognized, Genum will:

  1. Look up the memory extension associated with the key.
  2. Inject that memory into the prompt context before execution.
  3. Extend the prompt logic without changing the base specification.

This enables advanced use cases like:

  • Customer-specific business logic
  • Workflow-based behavior switching
  • Role-based responses or tone adjustments

Memory and Testing

Just like prompt inputs, memory keys should be tested as part of your regression strategy.

In a test case, you can specify a memoryKey:

  • This ensures the injected context is validated.
  • It verifies that the prompt produces correct behavior for different contextual conditions.
  • It protects against regressions when memory logic evolves.

Test coverage for memory-driven behavior is essential in complex agent-based systems.


Why It Matters

Memory transforms Genum prompts from static templates into modular, extensible agents that can adapt on demand.

  • Centralized memory config = less duplication
  • Contextual logic = fewer prompt variants
  • Better abstraction = cleaner specs and more powerful testing

Memory Keys are the foundation for context-driven prompting — critical for multi-tenant logic, personalization, and real-world production AI.


Integration Options

Memory Keys can be used with Genum's integration options: