How uittorio/mentor-plugin works
1. Repository shape
This is a multi-crate Rust workspace centered on a “mentor mode” learning system. The core architecture is split into:
- agent-side skills and plugin packaging,
- an MCP server that exposes learning operations,
- a reusable learning library,
- a dashboard for viewing progress,
- and migrations/install scripts around those pieces.
2. Agent integration layer
The claude-plugin and opencode-plugin directories package the same mentoring experience for two coding agents: Claude Code and OpenCode. The mentor+ skill changes the agent’s behavior to Socratic guidance, while mentor+-summarise post-processes a session at the end. These are not the knowledge system itself; they are the front-end interaction layer that drives the system through tools and files.
3. MCP server as the orchestration boundary
knowledge/mcp is the runtime service the agent talks to. Its job is to translate high-level mentoring actions into storage and review operations. The exposed tools are:
- create_session
- get_topics
- get_topic_candidates
- topic_depth
- review_topic
This is the main integration point between the agent and the learning backend.
4. Learning domain core
knowledge/learning is the shared domain library. It contains the primary concepts:
- topic
- session
- session_storage / topic_storage
- sm2 spaced repetition logic
- trigram_similarity for fuzzy topic matching
- storage_error
This crate is where the learning rules live, independent of any UI or transport.
5. Persistence model
The repository uses two kinds of storage concerns:
- structured learning data in SQLite, via knowledge/learning/src/sqlite
- session draft files in markdown, via knowledge/learning/src/file_storage
The SQLite side stores topics, sessions, and review state; the file side stores the human-readable session narrative that the summariser later edits.
6. Data flow at session start
A typical session starts with the agent asking the MCP server for topic context. The backend can:
- find known topics with fuzzy matching,
- compute which topics are due for review,
- and determine how deep the agent should go on each topic via topic_depth.
This is the “what should I ask about now?” decision path.
7. Data flow during the session
As the conversation progresses, the agent records outcomes back through review_topic. That updates the spaced-repetition state, including intervals and future review timing. This is the feedback loop that makes the mentor remember what the user knows and struggles with across sessions.
8. Session draft and summarisation flow
Each session has a running markdown draft file. The mentor+-summarise skill reads that draft near the end of a session, enriches it with conversation context, git history, and referenced files, then prepends a structured summary. This is a file-based workflow, separate from the SQLite knowledge store.
9. Dashboard subsystem
knowledge/dashboard is a separate Rust binary for visualising historical topics and sessions. It is the reporting/read-only side of the system, likely reading from the same persisted knowledge data to show progress over time. Architecturally, it is downstream of the learning storage layer, not part of the agent interaction loop.
10. Schema and lifecycle support
knowledge/migrations owns database schema evolution for the SQLite-backed store. The top-level scripts and install tests support packaging and deployment:
- scripts/install-dashboard.sh
- scripts/mcp-server.sh
- scripts/release.sh
- tests_installs/*
These are operational glue, but they matter because the system is split across agent plugins, a background MCP service, and a local persistence store.
11. Key architectural boundary
The most important boundary in this repo is between:
- behavioral guidance in the agent skill,
- stateful knowledge tracking in the MCP + learning crates,
- and presentation/reporting in the dashboard and summariser.
That separation is what lets the mentoring behavior stay portable across agents while the learning state remains centralized and persistent.
Main entry points: lib.rs Learning lib · main.rs MCP server · session_storage.rs Storage API · mod.rs SQLite store
Components 21
Agent plugins
Packaged mentoring behavior for Claude Code and OpenCode.
- Claude plugin · Claude Code packaging for mentor mode.
claude-plugin - OpenCode plugin · OpenCode packaging for mentor mode.
opencode-plugin - Mentor skill · Socratic guidance behavior for the agent.
claude-plugin/skills/mentor+/SKILL.md - Summarise skill · End-of-session draft enrichment and summary.
claude-plugin/skills/mentor+-summarise/SKILL.md
Learning backend
Central stateful knowledge system and its services.
- MCP server · Agent-facing orchestration boundary.
knowledge/mcp/src/main.rs - Tool service · Dispatches learning operations to tool handlers.
knowledge/mcp/src/tool_service.rs - Session tools · Session creation and topic review operations.
knowledge/mcp/src/create_session.rs - Topic tools · Topic lookup, depth, and candidate selection.
knowledge/mcp/src/get_topics.rs - Learning lib · Shared learning rules and persistence abstractions.
knowledge/learning/src/lib.rs - Topic model · Topics and session concepts.
knowledge/learning/src/topic.rs - Session model · Session state and lifecycle data.
knowledge/learning/src/session.rs - Storage API · Session/topic storage traits and errors.
knowledge/learning/src/session_storage.rs - SM2 logic · Review intervals and future scheduling.
knowledge/learning/src/sm2.rs - Topic matching · Fuzzy matching for candidate topics.
knowledge/learning/src/trigram_similarity.rs - SQLite store · Structured learning data persistence.
knowledge/learning/src/sqlite/mod.rs - File storage · Markdown session draft persistence.
knowledge/learning/src/file_storage/mod.rs - Dashboard · Read-only progress and history UI.
knowledge/dashboard/src/main.rs
Ops & packaging
Install, release, and schema lifecycle support.
- Migrations · Database schema evolution entrypoint.
knowledge/migrations/src/main.rs - Install scripts · Packaging and local installation scripts.
scripts/install-dashboard.sh - Release flow · Release and server launcher scripts.
scripts/release.sh - Install tests · Smoke tests for dashboard and OpenCode installs.
tests_installs/dashboard_install_tests.sh
Connections 24
- Claude plugin → Mentor skill: packages · Ships the mentor behavior as a Claude plugin.
- Claude plugin → Summarise skill: packages · Ships the session summariser skill.
- OpenCode plugin → Mentor skill: mirrors · Provides the same guidance behavior for OpenCode.
- OpenCode plugin → Summarise skill: mirrors · Provides the same summarisation flow for OpenCode.
- Mentor skill → MCP server: uses tools · Agent guidance is driven through MCP operations.
- Summarise skill → File storage: edits draft · Reads and prepends the session markdown draft.
- MCP server → Tool service: routes · Entrypoint delegates to tool dispatch.
- Tool service → Session tools: executes · Handles session creation and review operations.
- Tool service → Topic tools: executes · Handles topic lookup and depth operations.
- MCP server → Learning lib: depends on · Uses shared learning domain logic.
- Session tools → Storage API: updates · Writes review outcomes through storage abstractions.
- Topic tools → Topic matching: matches · Finds topic candidates with fuzzy similarity.
- Topic tools → SM2 logic: scores · Determines review depth and due status.
- Learning lib → Topic model: defines · Core topic concepts.
- Learning lib → Session model: defines · Core session concepts.
- Learning lib → Storage API: abstracts · Storage traits and error boundaries.
- Storage API → SQLite store: backed by · SQLite implementation for durable learning state.
- Storage API → File storage: backed by · Markdown-backed session draft storage.
- SQLite store → Migrations: evolves with · Schema changes are managed through migrations.
- Dashboard → SQLite store: reads · Dashboard reports over persisted learning data.
- Migrations → SQLite store: migrates · Creates and updates the SQLite schema.
- Install scripts → Dashboard: installs · Operational script for dashboard deployment.
- Release flow → MCP server: launches · Operational script for running the MCP server.
- Install tests → Dashboard: verifies · Checks dashboard installation behavior.