From mos
Session context management and user memory. Relevant for managing USER.md, tracking user preferences, and providing context-aware greetings across sessions.
npx claudepluginhub jsagir/mindrian-os-pluginThis skill uses the workspace's default tool permissions.
On first interaction, create `USER.md` in the workspace root capturing:
Conducts multi-round deep research on GitHub repos via API and web searches, generating markdown reports with executive summaries, timelines, metrics, and Mermaid diagrams.
Dynamically discovers and combines enabled skills into cohesive, unexpected delightful experiences like interactive HTML or themed artifacts. Activates on 'surprise me', inspiration, or boredom cues.
Generates images from structured JSON prompts via Python script execution. Supports reference images and aspect ratios for characters, scenes, products, visuals.
On first interaction, create USER.md in the workspace root capturing:
On each session start, read USER.md to personalize the interaction. Update USER.md when user shares new context (new venture details, changed preferences).
When USER.md and STATE.md exist, greet with awareness: "I see you were working on [last topic]. You have [N] banked opportunities -- strongest: [problem]. You still have gaps in [empty rooms]. Want to continue with [suggested next action]?"
Only include opportunity count if [Opportunity Bank] context is present in the session injection.
Reference specific room state -- entry counts, recent activity, identified gaps.
When the active room resolves under ~/MindrianRooms/ (via scripts/resolve-room), include the location naturally in the greeting. Example: "Your rooms live at ~/MindrianRooms/. Active room: [name]."
For first-session users with a room under MindrianRooms, mention the centralized location once: "All your Data Rooms are organized under ~/MindrianRooms/." Do not repeat this every session -- mention it on first encounter or after migration.
When session-start injects [Opportunity Bank] context, include opportunity awareness in the greeting:
Keep it brief -- 1-2 sentences woven into the greeting, not a separate block. The opportunity bank is part of where-you-left-off awareness, not a feature announcement.
When NO [Opportunity Bank] context is injected (empty bank or no room), do not mention it. Do not say "your opportunity bank is empty" -- that adds no value.
When session-start injects [MindrianOS Mode Routing] context (no room detected), defer to the conversation-mode skill for behavioral instructions. The three modes are:
When a room EXISTS, the conversation-mode skill is inactive. Standard room-aware greeting applies.
Track conversation threads across sessions. When user returns:
When ~/MindrianRooms/.rooms/registry.json (or workspace .rooms/registry.json for legacy) exists AND has 2 or more rooms registered, the session greeting includes a room list after the standard greeting:
Format (appended after the active room's state summary):
Other rooms:
|- fintech-startup parked 3 days ago
|- biotech-venture archived
▷ /mos:rooms Manage your rooms
▷ /mos:rooms open fintech-startup Switch rooms
Rules:
When the tengu_kairos environment variable is set to true OR the file room/.mindrian/kairos-active exists, KAIROS background memory is available. In this mode:
room/.mindrian/kairos/daily-log.md (or the path in KAIROS_LOG_PATH env var if set). This contains the consolidated memory from KAIROS background processing.room/.mindrian/last-session.md for structured session state (active_methodology, open_questions, next_suggested_action, confidence_level). This supplements the KAIROS log with MindrianOS-specific session data.When tengu_kairos is NOT set and kairos-active does not exist, this section is a no-op. Fall through to standard session continuity (USER.md + STATE.md) with zero overhead.
Graceful degradation: If the flag is set but the daily log file is missing or empty, fall back to standard context rebuild and log a note: "KAIROS flag detected but no daily log found -- using standard context."
Read /tmp/mindrian-context-state if it exists. If the file is missing or older than 5 minutes (compare TIMESTAMP to current epoch), use conservative defaults: assume 200K context window, 50% usage, unknown model.
| Model Contains | Context Size | Strategy |
|---|---|---|
| opus | 1,000,000 | Rich context: load full methodology references inline when relevant |
| sonnet | 200,000 | Lean context: thin skills only, summarize references instead of quoting |
| haiku | 200,000 | Minimal: essential context only, shortest responses |
| (unknown) | 200,000 | Conservative: treat as Sonnet |
Different user types have different optimal compact thresholds. The session-start hook injects the user archetype into context. Use these thresholds to decide when to suggest /clear or switch to concise mode:
| Archetype | Compact Threshold | Rationale |
|---|---|---|
| student | 65% | Students need headroom for exploratory Q&A. Compact early to keep teaching quality high. |
| default | 72% | Standard users get the balanced threshold. |
| venturist | 75% | Venturists run pipelines that consume context. Let them use more before suggesting compact. |
| researcher | 78% | Researchers do deep dives with Brain queries and literature. They need the most runway before interruption. |
When the session context header shows [Archetype: X], use that archetype's threshold instead of the default 70% rule below.
| Usage | Action |
|---|---|
| < 50% | Normal operation. Load references freely. |
| 50% to archetype threshold | If user requests heavy methodology, mention context is moderate. |
| Archetype threshold to threshold+15% | Warn: "We're at ~X% context. Consider /clear before starting a new methodology to keep quality high." |
| Threshold+15% to 95% | Active warning: "Context is getting tight. I'll be more concise. Strongly suggest /clear to free space." |
| > 95% | Critical: "Auto-compact will trigger soon. Your room context will reload automatically, but you may want to /clear now for a clean start." |
When context is constrained (above 60% on Sonnet, above 80% on Opus):
When context is plentiful: