# Feature AI-163 - Update the semantic index when work packages are created or edited or deleted

Project: Stream AI
Status: needs review
URL: https://community.openproject.org/work_packages/AI-163

## Planning

| Attribute | Value |
| --- | --- |
| Date |  |
| Priority | Medium |
| Target versions | 18.1.0 |
| List |  |
| Roadmap |  |
| Relevance |  |

## OPEN POINTS / FEEDBACK

_No work packages_

## Features and Chunks

_No work packages_

## Bugs and other work packages

_No work packages_

## Technical Details

| Attribute | Value |
| --- | --- |
| Module | Artificial Intelligence / Semantic Search (SemS) |
| Feature Flag | Semantic search |
| Requires doc change | No |
| Enterprise plan |  |

## Details

| Attribute | Value |
| --- | --- |
| Pull preview |  |
| Mockups |  |

## People

| Attribute | Value |
| --- | --- |
| Assignee | Joel Koch |
| Accountable | Dominic Bräunlein |
| Product manager | Dominic Bräunlein |
| Developers | Joel Koch |
| Designer |  |
| Ordered by |  |
| Signed off by |  |
| Interest by |  |

## Estimates and progress

| Attribute | Value |
| --- | --- |
| Work |  |
| Labor costs |  |

## Description

**As an** OpenProject user searching by meaning  
**I want to** find new work packages and the current text of edited ones  
**so that** semantic search results are up to date without an admin running a full re-index

**Acceptance criteria**

*   A newly created work package is embedded and becomes findable by semantic search.
    
*   Changing the subject or description of a work package updates its embedding.
    
*   Changes to other attributes (status, assignee, dates, …) do not trigger an embedding call.
    
*   Several quick edits to the same work package lead to one embedding call, not one per save.
    
*   Nothing is embedded while semantic search has no active semantic index.
    
*   A rate-limited embedding request is retried and does not get lost.
    

**Technical notes**

*   Subscribe in the llm engine to `OpenProject::Events::AGGREGATED_WORK_PACKAGE_JOURNAL_READY`, the event that notifications and webhooks already use, so edits are batched.
    
*   Check the journal for changes to `subject` or `description`, the only fields in `Llm::WorkPackages::EmbeddableText`.
    
*   Schedule `Llm::EmbedWorkPackagesJob` for the created or updated work package, which already overwrites the existing vector and retries on `RateLimitedError`.
    
*   Deleted work packages need no handling: `work_package_embeddings` removes their rows through `ON DELETE CASCADE`.
    

**Out of scope**

*   Re-embedding when comments, custom fields or attachments change. They aren&#x27;t part of the embedded text yet.
    
*   Changing the embedding model. That stays a full re-index from the admin page.
