### Run Context Hub Setup (Bash) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/README.md Executes the setup command for the Context Hub plugin. This command verifies prerequisite installations (Serena, Context7), configures the Forgetful MCP server, and reports the setup status. ```bash /context-hub-setup ``` -------------------------------- ### Install Context7 Plugin Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Installs the Context7 plugin, recommended for framework documentation and the `/context_gather` command. This command specifies the marketplace for installation. ```bash claude plugins install context7 --marketplace pleaseai/claude-code-plugins ``` -------------------------------- ### Check Plugin Installation Status Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Lists all installed Claude plugins. This command is useful for verifying if prerequisites like Serena and Context7 are already installed before proceeding with Context Hub setup. ```bash claude plugins list ``` -------------------------------- ### Install Serena Plugin Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Installs the Serena plugin, which is required for symbol-level code analysis and the `/encode-repo-serena` command. This command can be run directly from the terminal. ```bash claude plugins install serena ``` -------------------------------- ### Check uvx Installation Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Verifies if the 'uvx' command-line tool is installed and accessible in the system's PATH. uvx is a dependency for the standard Forgetful MCP setup. ```bash which uvx ``` -------------------------------- ### Search for Serena Plugin Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Searches for the Serena plugin within the Claude plugin marketplace. This is an alternative method to find and install the plugin if direct installation fails or if you need to explore available versions. ```bash claude plugins search serena ``` -------------------------------- ### Install Context Hub Plugin (Bash) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/README.md Installs the Context Hub plugin using the 'claude plugins install' command. This can be done from the marketplace or a local path. ```bash claude plugins install context-hub-plugin --marketplace forgetful-plugins ``` ```bash claude plugins install /path/to/context-hub-plugin ``` -------------------------------- ### Search for Context7 Plugin Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Searches for the Context7 plugin within the Claude plugin marketplace. Use this command if you need to find the plugin or verify its availability before installation. ```bash claude plugins search context7 ``` -------------------------------- ### Add Forgetful MCP (Standard Setup) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Adds and configures the Forgetful MCP with standard settings, using uvx and SQLite for storage. This is the recommended zero-configuration approach for most users. ```bash claude mcp add forgetful --scope user -- uvx forgetful-ai ``` -------------------------------- ### Check Serena Plugin Installation Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Verifies if the Serena plugin is installed in the Claude environment. If not installed, it provides instructions on how to install it. This is a prerequisite for using the encode-repo-serena command. ```bash claude plugins list | grep -i serena ``` -------------------------------- ### List Configured MCPs Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Lists all configured MCPs (and filters for 'forgetful'). This command is used to check if Forgetful MCP is already set up and to confirm its status after configuration. ```bash claude mcp list | grep -i forgetful ``` -------------------------------- ### Context Retrieval Commands (Bash) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/README.md Examples of using Context Hub commands for gathering context and managing memories. These commands help retrieve information from various sources and interact with the memory system. ```bash # Before implementing a feature /context_gather implement OAuth2 authentication for the API ``` ```bash # Bootstrap a new project into the knowledge base /encode-repo-serena ``` ```bash # Quick memory search /memory-search authentication patterns ``` ```bash # Save an important decision /memory-save ``` -------------------------------- ### Remove Forgetful MCP Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/context-hub-setup.md Removes an existing Forgetful MCP configuration. This is a preparatory step if a user chooses to reconfigure Forgetful. ```bash claude mcp remove forgetful ``` -------------------------------- ### Execute Forgetful Tool: Create Entry Memory Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md This code example shows how to create an atomic memory entry using 'execute_forgetful_tool' to summarize and link to the architecture document. It includes a title, content summarizing key aspects of the architecture, a context description, keywords, tags, importance level, and links to project and document IDs. ```python execute_forgetful_tool("create_memory", { "title": "[Project] - Architecture Reference", "content": "[Layer count]-layer architecture: [list layers]. Key patterns: [top 4-5 patterns]. Core components: [top 5 by reference count]. Full reference in linked document.", "context": "Entry point for architecture deep-dives - links to comprehensive document", "keywords": ["architecture", "layers", "patterns", "design", "structure"], "tags": ["architecture", "reference", "foundation"], "importance": 9, "project_ids": [], "document_ids": [] }) ``` -------------------------------- ### Get Symbol Overview for Source Files Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Retrieves a symbol overview for a given source file, including classes, functions, and methods along with their locations. This is a foundational step for symbol-level architecture analysis. ```python mcp__plugin_serena_serena__get_symbols_overview({ "relative_path": "src/main.py", "depth": 1 }) ``` -------------------------------- ### Get Symbols Overview (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-serena-symbols/SKILL.md Retrieves a high-level view of symbols within a specified file, including classes, functions, and variables with their kind and location. It's recommended to start here when exploring a new file. ```python mcp__plugin_serena_serena__get_symbols_overview({ "relative_path": "src/services/auth.py", "depth": 1 # 0=top-level only, 1=include methods }) ``` -------------------------------- ### Find Entry Points (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/serena-code-architecture/SKILL.md Search for files that typically serve as application entry points, such as those containing `if __name__ == '__main__'`, `def main()`, or framework-specific app initializations. It also shows how to retrieve symbols from a discovered entry file. ```python # Look for main/app files mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "if __name__.*==.*__main__|def main\(|app\s*=\s*FastAPI|createApp", "restrict_search_to_code_files": true }) # Get symbols from entry file mcp__plugin_serena_serena__get_symbols_overview({ "relative_path": "src/main.py", "depth": 1 }) ``` -------------------------------- ### Get Entity by ID (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves an entity based on its unique identifier. Requires an entity_id. ```python execute_forgetful_tool("get_entity", {"entity_id": 1}) ``` -------------------------------- ### Activate Serena Project Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Activates a Serena project, which is a critical first step before performing any symbol operations. It can use the current working directory or a registered project name. If activation fails, it lists available projects. ```python mcp__plugin_serena_serena__activate_project({ "project": "/path/to/project" }) ``` -------------------------------- ### Get Project Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves detailed information for a specific project by its ID. Requires the project_id as an integer. ```python execute_forgetful_tool("get_project", {"project_id": 1}) ``` -------------------------------- ### Query Context7 Framework Documentation Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Queries documentation specific to major frameworks like FastAPI, React, and PostgreSQL. It helps validate API usage, check for deprecated methods, and confirm best practices. It uses a `libraryId` obtained from `resolve_library_id`. ```python mcp__plugin_context7_context7__query_docs({ "libraryId": "/tiangolo/fastapi", "query": "Depends pattern for request validation" }) ``` -------------------------------- ### Get Entity Relationships (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves relationships associated with an entity. Requires an entity_id and optionally accepts direction (outgoing, incoming, both) and relationship_type. ```python execute_forgetful_tool("get_entity_relationships", { "entity_id": 1, "direction": "both" }) ``` -------------------------------- ### Get Memory Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves a complete memory by its unique ID. Requires the memory_id as an integer. Returns the full memory object with all associated fields. ```python execute_forgetful_tool("get_memory", {"memory_id": 42}) ``` -------------------------------- ### List Projects by Repository Name with Forgetful Tool Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Discovers project IDs by providing a repository name. This is the recommended method for finding project IDs, as it avoids assumptions about ID values. The function returns project metadata, including name, description, type, and context notes. ```python execute_forgetful_tool("list_projects", { "repo_name": "ScottRBK/forgetful-plugin" }) ``` -------------------------------- ### Get Document by ID (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves a specific document using its unique identifier. Requires the `document_id` as an integer. This function is part of the document management tools. ```python execute_forgetful_tool("get_document", {"document_id": 1}) ``` -------------------------------- ### Discover Project Structure (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/serena-code-architecture/SKILL.md List directories recursively or non-recursively to understand the project's high-level layout. This helps identify main modules and organizational patterns. ```python # Get directory structure mcp__plugin_serena_serena__list_dir({ "relative_path": ".", "recursive": false }) # Identify key directories (src/, app/, lib/, etc.) mcp__plugin_serena_serena__list_dir({ "relative_path": "src", "recursive": true }) ``` -------------------------------- ### Get Entity Memories (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves all memories linked to a specific entity. Requires an entity_id and returns a JSON object containing memory IDs and count. ```python execute_forgetful_tool("get_entity_memories", {"entity_id": 42}) ``` -------------------------------- ### Get Code Artifact by ID (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves a specific code artifact using its `artifact_id` (int). This function allows access to stored code snippets and their metadata. ```python execute_forgetful_tool("get_code_artifact", {"artifact_id": 1}) ``` -------------------------------- ### Read Key Project Files Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Reads essential project files such as README.md and pyproject.toml to gain an understanding of the project. It can also be adapted for other manifest files like package.json, Cargo.toml, etc. ```python mcp__plugin_serena_serena__read_file({"relative_path": "README.md"}) mcp__plugin_serena_serena__read_file({"relative_path": "pyproject.toml"}) # or package.json, Cargo.toml, etc. ``` -------------------------------- ### Search for Main Workflow Patterns in Code Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md This snippet searches for common entry points or main execution functions within code files. It looks for function definitions like 'def main', 'def run', 'def process', and 'def execute'. The search is restricted to code files. ```python mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "def main|def run|def process|def execute", "restrict_search_to_code_files": true }) ``` -------------------------------- ### Get Recent Memories Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves the most recently created memories, sorted by creation time. Accepts an optional limit for the number of results (1-100) and can filter by project IDs. ```python execute_forgetful_tool("get_recent_memories", {"limit": 5}) ``` -------------------------------- ### Explore Project Structure with Serena Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Lists the directory structure of the activated project using Serena. It allows for recursive exploration, skipping ignored files, and specifying a relative path. This is used to understand the project's organization. ```python mcp__plugin_serena_serena__list_dir({ "relative_path": ".", "recursive": true, "skip_ignored_files": true }) ``` -------------------------------- ### Get Recent Memories - Forgetful Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/SKILL.md Retrieves a list of the most recent memories associated with a specific project. This is useful for quickly reviewing project context or understanding recent captures. ```python execute_forgetful_tool("get_recent_memories", { "limit": 10, "project_ids": [PROJECT_ID] }) ``` -------------------------------- ### Create Project Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Creates a new project container. Requires a name, description, and project type. Optional fields include status, repository name, and notes. ```python execute_forgetful_tool("create_project", { "name": "my-project", "description": "A new development project", "project_type": "development", "repo_name": "owner/my-project" }) ``` -------------------------------- ### Find Project Dependency Manifest Files Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Searches for dependency manifest files within a project's directory. This is crucial for identifying the project's dependencies across various programming languages and ecosystems. ```python mcp__plugin_serena_serena__find_file({ "file_mask": "package.json", "relative_path": "." }) ``` -------------------------------- ### Trace Dependencies (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/serena-code-architecture/SKILL.md Identify how components are connected by finding symbols that reference a specific component and by retrieving the dependencies of a given component. This helps in understanding call hierarchies and relationships. ```python # Find who uses AuthService mcp__plugin_serena_serena__find_referencing_symbols({ "name_path": "AuthService", "relative_path": "src/services/auth.py" }) # Find what AuthService depends on mcp__plugin_serena_serena__find_symbol({ "name_path_pattern": "AuthService/__init__", "include_body": true }) ``` -------------------------------- ### Get Serena Symbols Overview Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Retrieves an LSP-accurate symbol listing for a given file, including classes, functions, and methods with their precise line locations. This is useful during repository encoding to identify key symbols in each architectural layer. ```python mcp__plugin_serena_serena__get_symbols_overview({ "relative_path": "src/services/auth.py", "depth": 1 }) ``` -------------------------------- ### Read File Content in Serena Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Reads the content of project files. This is primarily used during the initial discovery phase to analyze entry points, such as README files, package manifests (e.g., package.json, pyproject.toml), and key configuration files. ```python mcp__plugin_serena_serena__read_file({ "relative_path": "README.md" }) ``` -------------------------------- ### Get Current User Info (Python) Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/TOOL_REFERENCE.md Retrieves information about the currently authenticated user. This function requires no parameters and returns user details including `id`, `external_id`, `name`, `email`, `notes`, and `timestamps`. ```python execute_forgetful_tool("get_current_user", {}) ``` -------------------------------- ### Project Discovery - Get Repository URL Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/memory-save.md Retrieves the remote URL of the current Git repository. This is the first step in discovering the associated project ID, as the repository name is extracted from this URL. ```bash git remote get-url origin # e.g., "git@github.com:owner/repo-name.git" ``` -------------------------------- ### Create/Update Project in Forgetful Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Creates a new project entry in the Forgetful system or updates an existing one. This includes providing a name, description, project type, and repository name. ```python execute_forgetful_tool("create_project", { "name": "owner/repo-name", "description": "", "project_type": "development", "repo_name": "owner/repo" }) ``` -------------------------------- ### List Directory Contents in Serena Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Explores the project's directory structure. It can perform recursive searches and optionally skip ignored files (respecting .gitignore). This function is useful for assessing project size and identifying entry points during the discovery phase. ```python mcp__plugin_serena_serena__list_dir({ "relative_path": ".", "recursive": True, "skip_ignored_files": True }) ``` -------------------------------- ### Get Current Repository - Bash Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-forgetful-memory/SKILL.md Retrieves the URL of the current Git repository's origin. This command is used to identify the repository name and owner for project discovery within the Forgetful system. ```bash git remote get-url origin ``` -------------------------------- ### Search for Dependency Injection Patterns in Code Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md This snippet searches for patterns related to Dependency Injection and Inversion of Control (IoC) in code files. It looks for keywords like 'Depends(', '@inject', 'Container', and constructor definitions with parameters. The search is restricted to code files. ```python mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "Depends\(|@inject|Container|def __init__\(self,.*:", "restrict_search_to_code_files": true }) ``` -------------------------------- ### Phase 5: Get Entity Memories - Forgetful Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/exploring-knowledge-graph/SKILL.md Retrieves all memories linked to a specific entity. This helps in consolidating information related to an entity and identifying any new memories that haven't been visited yet. ```python execute_forgetful_tool("get_entity_memories", { "entity_id": }) ``` -------------------------------- ### Retrieve Document with Forgetful Tool Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Retrieves long-form content, typically exceeding 2000 characters, formatted in markdown. Documents are linked from atomic memories via 'document_ids' and are useful for comprehensive documentation like architecture guides or detailed analysis. ```python execute_forgetful_tool("get_document", { "document_id": 15 }) ``` -------------------------------- ### Activate Project in Serena Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md Activates a project within the Serena system, which is a mandatory first step before performing any operations. It requires the project path or name as an argument. Handles cases where the project is not found and provides guidance. ```python mcp__plugin_serena_serena__activate_project({ "project": "" }) ``` -------------------------------- ### Phase 4: Get Entity Relationships - Forgetful Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/exploring-knowledge-graph/SKILL.md Maps the relationships between a given entity and other entities in the knowledge graph. It supports bidirectional exploration to understand connections like 'works_for', 'owns', 'manages', and 'collaborates_with'. ```python execute_forgetful_tool("get_entity_relationships", { "entity_id": , "direction": "both" }) ``` -------------------------------- ### FastAPI Project Analysis with Python Tools Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/serena-code-architecture/SKILL.md This Python script demonstrates how to analyze a FastAPI project using a set of hypothetical tools. It covers finding routers, examining router structure, identifying dependency injection, tracing service dependencies, and creating a memory to store architectural insights. Assumes the existence of functions like `mcp__plugin_serena_serena__search_for_pattern`, `mcp__plugin_serena_serena__get_symbols_overview`, `mcp__plugin_serena_serena__find_referencing_symbols`, and `execute_forgetful_tool`. ```python # 1. Find routers mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "APIRouter\(\)|router\s*=", "restrict_search_to_code_files": true }) # 2. Analyze router structure mcp__plugin_serena_serena__get_symbols_overview({ "relative_path": "src/routers/users.py", "depth": 1 }) # 3. Find dependency injection mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "Depends\(", "restrict_search_to_code_files": true, "context_lines_before": 1, "context_lines_after": 1 }) # 4. Trace service dependencies mcp__plugin_serena_serena__find_referencing_symbols({ "name_path": "get_current_user", "relative_path": "src/dependencies/auth.py" }) # 5. Create architecture memory execute_forgetful_tool("create_memory", { "title": "FastAPI app structure: Routers + Dependencies", "content": "App uses router-based organization with dependency injection. Routers: /users, /auth, /products. Dependencies: get_current_user, get_db. All routes require auth except /auth/login.", "context": "FastAPI architecture analysis", "keywords": ["fastapi", "router", "dependency-injection"], "tags": ["architecture", "pattern"], "importance": 8, "project_ids": [PROJECT_ID] }) ``` -------------------------------- ### Get Entity Relationships with Forgetful Tool Source: https://context7.com/scottrbk/context-hub-plugin/llms.txt Retrieves the knowledge graph edges connected to a specified entity. The 'direction' parameter can be set to 'outgoing' (what the entity uses/depends on), 'incoming' (what uses the entity), or 'both' for a comprehensive view of all relationships. The output includes relationship type, strength, and associated metadata. ```python execute_forgetful_tool("get_entity_relationships", { "entity_id": 12, "direction": "both" }) ``` -------------------------------- ### Launch Subagent with Task Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/memory-explore.md This code snippet demonstrates how to initiate a subagent for exploring the Forgetful knowledge graph. It specifies the subagent type, model, a descriptive purpose, and the prompt to be used. The 'general-purpose' subagent is configured with the 'haiku' model for this task. ```javascript Task({ subagent_type: "general-purpose", model: "haiku", description: "Explore Forgetful graph", prompt: }) ``` -------------------------------- ### Search for Database/Transaction Patterns in Code Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md This snippet searches for database and transaction management patterns within code files. It looks for keywords like 'session', 'transaction', 'commit', 'rollback', and 'with connection'. The search is restricted to code files. ```python mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "session|transaction|commit|rollback|with.*connection", "restrict_search_to_code_files": true }) ``` -------------------------------- ### Find Only Classes using Symbol Kinds in Python Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/using-serena-symbols/SKILL.md This example demonstrates how to filter search results to include only 'Class' symbol kinds using the `mcp__plugin_serena_serena__find_symbol` function in Python. It utilizes the `include_kinds` parameter with the integer value corresponding to the 'Class' kind (5). ```python mcp__plugin_serena_serena__find_symbol({ "name_path_pattern": "Service", "substring_matching": true, "include_kinds": [5] # Class only }) ``` -------------------------------- ### Phase 1: Query Memory - Forgetful Tool Source: https://github.com/scottrbk/context-hub-plugin/blob/master/skills/exploring-knowledge-graph/SKILL.md Initiates knowledge graph exploration by querying memories related to a specific topic. It retrieves primary and linked memories, with options to control the number of results and include links. This is the first step in understanding broader context. ```python execute_forgetful_tool("query_memory", { "query": "", "query_context": "Exploring knowledge graph for comprehensive context", "k": 5, "include_links": true, "max_links_per_primary": 5 }) ``` -------------------------------- ### Search for UI Page/Component Patterns in Code Source: https://github.com/scottrbk/context-hub-plugin/blob/master/commands/encode-repo-serena.md This snippet searches for patterns indicating UI pages or components, particularly for frontend code. It looks for function or class definitions starting with 'export function Page', 'def page', or 'class View'. The search is restricted to code files. ```python mcp__plugin_serena_serena__search_for_pattern({ "substring_pattern": "export.*function.*Page|def.*page|class.*View", "restrict_search_to_code_files": true }) ```