Contextual Awareness

Contextual Awareness gathers proactive notifications at session start by querying the Rules Engine, Project Memory, and Agent Memory. These notifications surface pending actions, unresolved findings, and reminders without the user having to ask.

Notification types

TypePrioritySourceExample
rule_proposalhighRules Engine"Proposed rule: 'use strict mode' — confirm or reject"
unresolved_findingmediumProject Memory"Finding from last session: race condition in auth module"
agent_remindermediumAgent Memory"TODO: update API docs after refactor"
convention_violationhighRules Engine"Convention violated: missing JSDoc in src/api/"
stale_memorylowAgent Memory"5 memories haven't been used in 30 days"
project_statslowMultiple"KG: 1,234 triples — 45 conventions, 12 decisions"

How it works

At session_start, the gatherNotifications() method:

  1. Queries the Rules Engine for pending proposals (learned, disabled rules)
  2. Queries Project Memory for recent unresolved findings
  3. Searches Agent Memory for entries containing "TODO", "reminder", or "remember to"
  4. Compiles project statistics from available sources
  5. Sorts by priority (high → medium → low)

Notifications are injected into the session context as:

xml
<session-notifications>
[!] Proposed rule: 'use strict mode' — confirm or reject with `mayros rules confirm|reject`
[*] Finding from last session: race condition in auth module
[-] KG: 1,234 triples — 45 conventions, 12 decisions
</session-notifications>

Priority indicators: [!] high, [*] medium, [-] low.

Notification flow

mermaid
flowchart TD
    A[Session start] --> B[Gather notifications]
    B --> C[Query Rules Engine]
    B --> D[Query Project Memory]
    B --> E[Query Agent Memory]
    C --> F[Pending proposals]
    D --> G[Unresolved findings]
    E --> H[Agent reminders]
    F --> I[Sort by priority]
    G --> I
    H --> I
    I --> J[Inject into session context]