Memory

Contextual Boosting

Contextual boosting dynamically adjusts per-tier RRF weights during retrieval based on the current task context. Rather than treating all memory tiers equally in every query, the boosting layer detects what kind of task is underway and rebalances the fusion weights so the most relevant tiers are surfaced first. Research phases boost graph memory; debugging boosts session memory; debate rounds boost precision-oriented tiers.

How it works

Before each retrieval call, boosting runs in three steps:

  1. Context detector — Classifies the current message against a set of trigger phrases using lightweight keyword and embedding matching. The detector runs in under 2ms and does not add an extra LLM call.
  2. Weight adjustment — Applies a per-tier multiplier to the base RRF weights. A tier with a multiplier of 2.0 contributes twice as much to the fused ranking as a tier at 1.0.
  3. RRF fusion — The weighted RRF score is computed across all sources and the top-K results are assembled as normal. Downstream components receive the reranked results with no API changes required.

Built-in context profiles

ProfileSessionGraphKnowledge baseWorkspace
research0.81.81.51.0
debugging2.00.70.91.2
debate0.91.52.01.0
general1.01.01.01.0

The general profile is the default when no trigger phrase is detected. It applies equal weights to all tiers, preserving the baseline RRF behavior.

Custom profiles

Define your own profiles in astra.yml. Each profile specifies a list of trigger phrases (matched against the incoming message) and a set of tier weights:

yaml
settings:
  memory:
    boosting:
      enabled: true
      profiles:
        - name: research
          triggers: ["research", "summarize", "compare sources"]
          weights:
            graph: 1.8
            knowledgeBase: 1.5
            session: 0.8
            workspace: 1.0
        - name: debugging
          triggers: ["error", "exception", "traceback", "bug", "failing"]
          weights:
            session: 2.0
            workspace: 1.2
            graph: 0.7
            knowledgeBase: 0.9
        - name: debate
          triggers: ["argue", "defend", "counter", "refute", "evidence"]
          weights:
            knowledgeBase: 2.0
            graph: 1.5
            session: 0.9
            workspace: 1.0

Triggers are matched using a combination of keyword presence and cosine similarity. If multiple profiles match, the one with the highest aggregate trigger score is applied. Weights can be any positive number; they are normalized relative to the other tiers in the same retrieval call.

Enabling and disabling boosting

Boosting is enabled by default. To disable it and revert to uniform RRF weights across all tiers:

yaml
settings:
  memory:
    boosting:
      enabled: false
💡Boosting is applied automatically at the retrieval layer. No code changes are needed in agent logic or tool implementations — it is fully transparent to the rest of the system.