Plugin Architecture API
The Plugin Architecture API allows you to extend Arc Memory with additional data sources beyond the built-in Git, GitHub, and ADR plugins.Overview
Arc Memory uses a plugin-based architecture to ingest data from various sources. Each plugin is responsible for ingesting data from a specific source and converting it into nodes and edges in the knowledge graph. The plugin architecture is designed to be extensible, allowing you to add support for new data sources without modifying the core codebase.Key Components
IngestorPlugin
Protocol
get_name()
: Returns a unique name for the plugin (e.g., “git”, “github”, “adr”)get_node_types()
: Returns a list of node types the plugin can createget_edge_types()
: Returns a list of edge types the plugin can createingest()
: Ingests data from the source and returns nodes, edges, and metadata
IngestorRegistry
Class
register()
: Registers a plugin with the registryget()
: Gets a plugin by namelist_plugins()
: Lists all registered pluginsget_all()
: Gets all registered pluginsget_by_node_type()
: Gets plugins that can create a specific node typeget_by_edge_type()
: Gets plugins that can create a specific edge type
discover_plugins()
Function
- Built-in plugins (Git, GitHub, ADR)
- Third-party plugins registered via entry points
IngestorRegistry
containing all discovered plugins.
Creating a Custom Plugin
To create a custom plugin, you need to:- Create a class that implements the
IngestorPlugin
protocol - Register the plugin using entry points
Example Plugin
Registering the Plugin
To register your plugin, add an entry point to yoursetup.py
or pyproject.toml
:
Built-in Plugins
Arc Memory includes three built-in plugins:- Git Plugin: Ingests data from Git commits and files
- GitHub Plugin: Ingests data from GitHub PRs and issues
- ADR Plugin: Ingests data from Architecture Decision Records
discover_plugins()
.
Plugin Discovery Process
The plugin discovery process works as follows:- Create an empty
IngestorRegistry
- Register built-in plugins (Git, GitHub, ADR)
- Discover and register third-party plugins from entry points
- Return the registry
Incremental Ingestion
Plugins support incremental ingestion, which allows them to only process new data since the last build. This is done by passing thelast_processed
parameter to the ingest()
method, which contains metadata from the previous run.
For example, the Git plugin uses the last processed commit hash to determine which commits are new, while the GitHub plugin uses the last processed PR and issue numbers.
Error Handling
The plugin architecture includes comprehensive error handling:- Failed plugin loading doesn’t prevent other plugins from being loaded
- Detailed error messages for common issues
- Graceful handling of plugin failures
- Debug logging for troubleshooting
Performance
The plugin discovery process is designed for performance:- Plugin discovery typically takes less than 100ms
- Plugins are only loaded when needed
- Incremental ingestion reduces processing time