Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: obsidian integration plugin #1943

Merged
merged 2 commits into from
Jan 8, 2025

Conversation

sekmet
Copy link

@sekmet sekmet commented Jan 7, 2025

Relates to

This PR relates to the following issues:

Obsidian Integration #302

The development and maintenance of the @elizaos/plugin-obsidian package, focusing on enhancing elizaOS agents integration capabilities with Obsidian vaults.

Key features include:

  1. Deep traversal of Obsidian notes:

    • Implementing hierarchical note structure analysis
    • Enabling traversal of note links and backlinks
    • Storing hierarchy data in memory for efficient access
  2. Advanced search functionality:

    • Full-text search across all vault files
    • Support for regex patterns and context-aware searches
    • Integration with Obsidian's native search capabilities using Obsidian's Rest API
  3. Obsidian memory store integration:

    • Building and maintaining a knowledge base from vault notes
    • Implementing efficient data structures for quick retrieval
  4. Naval database integration as an example:

    • Demonstrating how to import and structure obsidian notes
    • Showcasing integration of Naval's wisdom and quotes
    • Creating a knowledge base from Naval's vault notes
    • Naval's character json file is included in the PR

These enhancements aim to provide users with powerful tools for knowledge management and retrieval within their Obsidian vaults, while also demonstrating the plugin's extensibility for integrating external data sources.

Risks

Low - This is a plugin package that integrates with Obsidian vault functionality using the Obsidian Rest API.

Main risks include:

  • File system operations safety
  • Data integrity when reading/writing notes
  • Performance with large vaults

Background

What does this PR do?

This PR maintains the Obsidian plugin package which provides integration between ELIZA OS agents and Obsidian vaults. The plugin enables:

  • File and note management within Obsidian vaults
  • Search functionality using Omnisearch
  • Note traversal and knowledge base features
  • Active note operations and file manipulation

What kind of change is this?

Features (non-breaking change which adds functionality):

  • Obsidian Vault operations (listing files, directory management)
  • Note management (content retrieval, metadata handling)
  • Search capabilities
  • File operations (read, write, update)

Documentation changes needed?

  • My changes do not require a change to the project documentation.

Obsisdian plugin is documented in the package README.md which includes:

  • Features documentation
  • Usage examples
  • API documentation

Testing

Where should a reviewer start?

  1. Review the main plugin definition in src/index.ts
  2. Check individual action implementations in src/actions/
  3. Verify the API documentation in README.md

Detailed testing steps

  1. Setup Testing Environment

    # Install dependencies
    pnpm install
    
    # Run tests
    pnpm test
    
    # For development with watch mode
    pnpm run test:watch
  2. Core API Tests (src/tests/obsidianClient.test.ts)

    • Test Authentication:

      • Verify successful connection to Obsidian API
      • Test authentication failure scenarios
    • Test Note Operations:

      • List all notes in vault
      • Get specific note content by path
      • Get active note content
      • Verify note metadata and frontmatter parsing
    • Test File Operations:

      • List all files in vault
      • List files in specific directory
      • Read file contents
      • Test file write/update operations
    • Test Search Functionality:

      • Plain text search: obsidianProvider.search('query', 'plaintext')
      • Dataview queries: obsidianProvider.search('TABLE field FROM "folder"', 'dataview')
      • JSON Logic queries: obsidianProvider.search({ var: 'field' }, 'jsonlogic')
      • Keyword search: obsidianProvider.searchKeywords('keyword1 OR keyword2')
    • Test Command Integration:

      • List available Obsidian commands
      • Execute commands through API
  3. Error Handling Tests

    • Test API connection failures
    • Verify error handling for invalid requests
    • Check error messages for missing files/notes
    • Test authentication error scenarios
  4. Integration Testing

    • Test plugin integration with Obsidian app
    • Verify real-time updates and file synchronization
    • Test concurrent operations handling
    • Verify memory management and cleanup

Expected test results:

  • All unit tests should pass
  • API endpoints should respond with correct data
  • Error scenarios should be properly handled
  • No memory leaks in long-running operations

Database changes

  • Store notes knowledge base fragments and notes hierarchy data in the memory

Discord username

@sekmet2600

@ag-wnl ag-wnl added the Plugin_new Mark PRs that are a new plugin label Jan 7, 2025
@babywen-ai
Copy link

Waw good job guys, we are waiting for that <3

@wtfsayo wtfsayo added the testing label Jan 7, 2025
@wtfsayo wtfsayo self-requested a review January 7, 2025 09:42
@derekbeau
Copy link

This is amazing. Was already planning to use Obsidian as an agent knowledge source manager by simply accessing the files directly.

@shakkernerd shakkernerd merged commit cae46f5 into elizaOS:develop Jan 8, 2025
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Plugin_new Mark PRs that are a new plugin testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants