---
title: registry | CodeWeaver Docs
description: API reference for codeweaver.engine.chunker.registry
url: "https://docs.knitli.com/api/engine/chunker/registry"
type: static
generatedAt: "2026-04-17T17:21:08.436Z"
---

# registry
       [Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F.%20I%20want%20to%20ask%20questions%20about%20it.)[View in Markdown](/codeweaver/api/engine/chunker/registry.md)       [Share on LinkedIn](https://www.linkedin.com/sharing/share-offsite/?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F)[Share on X](https://x.com/intent/tweet?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F&text=registry)[Share on Threads](https://threads.net/intent/post?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F&text=registry)[Share on Bluesky](https://bsky.app/intent/compose?text=registry%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F)[Share on Facebook](https://www.facebook.com/sharer/sharer.php?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F)[Share on Reddit](https://reddit.com/submit?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F&title=registry)[Share on Hacker News](https://news.ycombinator.com/submitlink?u=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F&t=registry)[Share on Email](mailto:?subject=registry&body=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F)[Share on WhatsApp](https://wa.me/?text=registry%20https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F)[Share on Telegram](https://t.me/share/url?url=https%3A%2F%2Fdocs.knitli.com%2Fcodeweaver%2Fapi%2Fengine%2Fchunker%2Fregistry%2F&text=registry)
# `codeweaver.engine.chunker.registry`
[Section titled “codeweaver.engine.chunker.registry”](#codeweaverenginechunkerregistry)
Registry for maintaining per-file source IDs for span consistency.

## Class: `SourceIdRegistry`
[Section titled “Class: SourceIdRegistry”](#class-sourceidregistry)
Maintains per-file source IDs to ensure span consistency within files.

This registry ensures that all spans from the same file share the same source_id, enabling set-like span operations and clean merging/splitting.

### Method: `clear`
[Section titled “Method: clear”](#method-clear)

**

```
clear()
```

Clear the registry.

### Method: `file_from_path`
[Section titled “Method: file_from_path”](#method-file_from_path)

**

```
file_from_path()
```

Get the DiscoveredFile instance for a given file path.

### Method: `remove`
[Section titled “Method: remove”](#method-remove)

**

```
remove()
```

Remove a file from the registry.

Args: value: UUID7 source ID or DiscoveredFile instance to remove

Returns: True if the file was in the registry, False otherwise

### Method: `source_id_for`
[Section titled “Method: source_id_for”](#method-source_id_for)

**

```
source_id_for()
```

Get or create a source ID for the given file.

Uses the DiscoveredFile’s existing source_id instead of generating a new one. This ensures consistency across the codeweaver system where DiscoveredFile objects serve as the canonical source of truth for file identity.

Args: file: DiscoveredFile instance with existing source_id

Returns: Hex string (newtype) representation of the file’s UUID7 source_id