{% extends "base.html" %} {% from "macros/_stack_card.html" import card %} {% block title %}Memory — {{ config.INSTANCE_NAME or 'AI Data Analyst' }}{% endblock %} {% block content %} {# Hero — gradient banner mirroring marketplace.html .mp-hero so /memory and /marketplace read as one product. #}
Knowledge

What does your team already know?

Browse curated knowledge domains your admin has approved. Add the ones your team relies on to your stack — required domains are added automatically.

{# v51 lifecycle filter — same pattern as /catalog. Default opt-in to Prod + POC. #}
Show: {% if user.is_admin %} {% endif %}
{# Pending-review banner is admin-only. The backend (router.py) already zeroes ``pending_review_count`` for non-admin viewers so the banner wouldn't render — but the explicit guard makes the gating intentional instead of accidental, and stops the /admin/corporate-memory link from ever leaking into a non-admin DOM if a future router change surfaces the count. #} {% if user.is_admin and pending_review_count and pending_review_count > 0 %}
{{ pending_review_count }} pending item{{ 's' if pending_review_count != 1 else '' }} awaiting review. Open review queue →
{% endif %}
{# Section order locked to match /marketplace + /catalog: hero → conditional banner → tabs-row (+ admin actions) → curator-block → filter pills → grid → empty state. #}
{# Admin-only right-of-tabs action — parallels /catalog's + New Data Package and marketplace's "Submit a skill or plugin" on the right edge of the tabs row. Links straight to the admin moderation page where domains are created + managed. #} {% if user.is_admin %}
{# Admin-only — the yellow ``admin-only`` chip is a visibility hint for the admin (analysts never see this affordance, the outer {% if user.is_admin %} gates it). #} Manage domains admin-only
{% endif %}
{# Curator-style info block — mirrors marketplace .mp-curator-block; sits BELOW the tab strip per the unified section order. #}
Each Memory domain is curated by your admin.
Domains bundle related knowledge items (rules, playbooks, decisions) so analysts can opt-in to a coherent body of context. Required domains are added to your stack automatically.
{% if entries %}
{% for entry in entries %} {{ card(entry) }} {% endfor %}
{% else %} {# Empty state — friendly + actionable, same shape as /catalog. #}
🧠

No Memory Domains yet

{% if user.is_admin %}

Memory Domains bundle related knowledge items (playbooks, runbooks, shared context) so analysts can opt-in to a coherent body of knowledge — instead of cherry-picking individual notes.

Create your first domain from the admin moderation queue.

{% else %}

Your domains will appear here once your admin adds memory items and grants your group access. Refresh when you've been told a new domain is ready — or suggest one yourself if there's a body of knowledge you'd like to see bundled.

{% endif %}
{% endif %}
{# Both grid and empty-state are always rendered; JS toggles visibility on add/remove so the tab never goes completely blank after the last card is removed (the "musím refreshnout" bug). #} {# v55 Suggest-a-domain modal — non-admin affordance from the empty-state CTA. Posts to /api/memory-domain-suggestions; admin queue surfaces it for approve/reject. #}
{% endblock %}