HiveLang v5

Memory

Memory lets an agent improve over time. Use it for stable context: preferences, seen items, voice profiles, user rules, and task state.

When to use memory

Use memory when the next run should know something learned in a previous run. Do not use it for passwords, API keys, raw sensitive data, or temporary values that only matter inside one handler.

  • Good: voice profile, preferred timezone, seen job links, last report date.
  • Bad: OAuth tokens, card numbers, one-time verification codes, private health data.

Remember a value

remember "preferred_timezone" as "Africa/Lagos"

The key should be stable and descriptive. Prefer voice_profile over thing.

Recall before acting

timezone = recall "preferred_timezone"
say f"I will schedule this using {timezone}."

For recurring agents, recall memory at the start of the schedule so the agent acts with the latest known preferences.

Pattern: learn a user's voice

This is the core pattern for content assistants, executive assistants, and brand operators.

bot SocialAssistant {
  description: "Learns a user's voice and drafts content"

  capabilities {
    knowledge.search
    ai.generate
    general.respond
  }

  instructions {
    Learn the user's tone, audience, content pillars, and approval rules.
    Draft for review unless the user explicitly approves publishing.
  }

  on user.message {
    voiceProfile = recall "voice_profile"
    context = call knowledge.search with { query: input }

    if input contains "learn my voice" {
      profile = call ai.generate with {
        prompt: f"Extract tone, phrases, audience, formatting, and do-not-say rules from: {input}. Context: {context}"
      }
      remember "voice_profile" as profile
      say f"I saved this voice profile: {profile}"
    } else {
      draft = call ai.generate with {
        prompt: f"Draft in this voice: {voiceProfile}. Use this context: {context}. Request: {input}"
      }
      say draft
    }
  }
}

Memory checklist

  • Recall before making a decision.
  • Remember after learning stable context.
  • Store summaries, not huge raw transcripts.
  • Ask before storing sensitive or surprising facts.

Next: run memory-powered agents on a schedule.

How helpful was this page?

Not helpfulExcellent