mcpbeat Sign in

Algo Rec Session Agent Skill

Implement session-based recommendation from short-term user behavior sequences without long-term profiles. Use this skill when the user needs to recommend in anonymous sessions, predict next click from browsing sequence, or build recommendations for non-logged-in users — even if they say 'what should they click next', 'anonymous user recommendations', or 'browsing sequence prediction'.

7k tokens
context cost
the whole folder, loaded on every use
4
files
instructions only
0
copies elsewhere
how many repositories repackaged it
223
stars on the repo
on the repository, not the skill itself

Install

one command, takes just this skill from the repository
npx skills add https://github.com/asgard-ai-platform/skills --skill algo-rec-session

What comes with it

23 095 bytes besides the instruction
examples/sample_scenario.md
references/gru4rec.md
references/session-splitting.md

The instruction itself

14 sections, as written by the author

Session-Based Recommendation

Overview

Session-based recommendation predicts the next item a user will interact with based on their current session's click/view sequence, without relying on long-term user profiles. Uses Markov chains, association rules, or neural approaches (GRU4Rec). Operates in real-time with O(sequence_length) inference.

When to Use

Trigger conditions:

  • Anonymous users (no login, no long-term profile)
  • Short browsing sessions where recency matters most
  • Real-time "next item" prediction during active sessions

When NOT to use:

  • When rich user history is available (use CF or content-based for better personalization)
  • When sessions are extremely short (1-2 clicks) — insufficient signal

Algorithm

IRON LAW: First Few Clicks Are Disproportionately Important
Session-based methods operate WITHOUT long-term profiles. Intent must
be inferred from SHORT sequences. The first 2-3 clicks establish the
session's intent — misreading early signals derails the entire session.

Phase 1: Input Validation

Parse clickstream into sessions (by session ID or timeout-based splitting, typically 30min inactivity). Filter sessions below minimum length (3+ events).

Gate: Sessions parsed, minimum length threshold applied.

Phase 2: Core Algorithm

Markov Chain approach:

  • Build transition matrix from item-to-item sequences across all sessions
  • For current session [A, B, C], predict next item from P(next | C) or higher-order P(next | B, C)

Association Rules approach:

  • Mine frequent item sequences (sequential pattern mining)
  • Match current session suffix against known patterns
  • Recommend items that frequently follow the matched pattern

Phase 3: Verification

Evaluate with leave-one-out: hide last item in each session, predict, check hit rate and MRR (Mean Reciprocal Rank).

Gate: Hit@20 significantly above random baseline.

Phase 4: Output

Return ranked next-item predictions with confidence scores.

Output Format

{
  "predictions": [{"item_id": "789", "score": 0.65, "based_on": "last_3_clicks"}],
  "session": {"length": 5, "items_viewed": ["a", "b", "c", "d", "e"]},
  "metadata": {"method": "markov_order2", "hit_rate_at_20": 0.35}
}

Examples

Sample I/O

Input: Session: [shoes_page, running_shoes, nike_air_max]

Expected: Recommend: nike_air_zoom (0.72), adidas_ultraboost (0.58), shoe_size_guide (0.41)

Edge Cases

| Input | Expected | Why |

|-------|----------|-----|

| Session length = 1 | Popularity fallback | Single click insufficient for sequence pattern |

| Repeated item views | Weight recency, not count | User may be comparing, not broadening |

| Session intent shift | Adapt to latest clicks | User changed their goal mid-session |

Gotchas

  • Session definition matters: 30-minute timeout is conventional but arbitrary. E-commerce may need shorter (15min); research browsing may need longer (60min).
  • Position bias: Users click top results more. Session data reflects UI position, not just preference. Correct for position bias.
  • Repeat recommendations: Users often revisit items. Distinguish "recommend something new" from "remind of previously viewed."
  • Cold start for new items: Items with zero prior session appearances can't be predicted by transition matrices. Mix in feature-based candidates.
  • Computational efficiency: For real-time inference, pre-compute transition probabilities. Recomputing per-request at scale is too slow.

References

  • For GRU4Rec neural session model, see references/gru4rec.md
  • For session splitting heuristics, see references/session-splitting.md

Other skills for the same job

different authors, same section of the catalogue
Skill Creator
by anthropics
vendor ×10

Create new skills, modify and improve existing skills, and measure skill performance. Use when users want to create a skill from scratch, edit, or optimize an existing skill, run evals to test a skill, benchmark skill performance with variance analysis, or optimize a skill's description for better triggering accuracy.

56k tokens scripts
Skill Creator
by vercel-labs
vendor ×10

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

12k tokens scripts
Skill Creator
by JayZeeDesign
×9

Guide for creating effective skills. This skill should be used when users want to create a new skill (or update an existing skill) that extends Claude's capabilities with specialized knowledge, workflows, or tool integrations.

10k tokens scripts
Template Skill
by JayZeeDesign
×7

Replace with description of the skill and when Claude should use it.

35 tokens
Dispatching Parallel Agents
by ZhanlinCui
×5

Use when facing 2+ independent tasks that can be worked on without shared state or sequential dependencies

2k tokens
Skill Development
by anthropics
vendor ×4

This skill should be used when the user wants to "create a skill", "add a skill to plugin", "write a new skill", "improve skill description", "organize skill content", or needs guidance on skill structure, progressive disclosure, or skill development best practices for Claude Code plugins.

9k tokens
Find Skills
by sanity-io
vendor ×4

Helps users discover and install agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. This skill should be used when the user is looking for functionality that might exist as an installable skill.

1k tokens
Writing Skills
by ZhanlinCui
×4

Use when creating new skills, editing existing skills, or verifying skills work before deployment

26k tokens scripts

How to use it

Copy the folder

Take asgard-ai-platform/algo-rec-session from the repository into ~/.claude/skills for personal use, or into .claude/skills inside a project.

Check the name does not clash

The agent identifies a skill by the name field in its header. Two skills with the same name cannot sit side by side — one of them will be ignored.