Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:416rehman DeepZero File Discovery

From Leeroopedia
Knowledge Sources
Domains File_Discovery, Ingest
Last Updated 2026-10-27 00:00 GMT

Overview

An ingest pattern that discovers a corpus of samples from a source path, assigns content-addressed identifiers, and extracts initial metadata for downstream filtering.

Description

File discovery is the first stage of any file-processing pipeline. It transforms a raw target (a file or directory) into a structured Sample stream that the pipeline can process. The core principle is content addressing: each sample is identified by a cryptographic hash of its content (typically sha256), not its filename or path. This ensures:

  • Deduplication: the same file at different paths produces the same sample ID, so duplicate work is detected.
  • Integrity: the hash ties the sample to its content; a changed file is a different sample.
  • Determinism: re-running discovery on the same corpus produces the same sample set.

Initial metadata extracted at discovery time (file size, hash) is available to all downstream stages, enabling early filtering before expensive analysis.

Usage

Use this pattern when:

  • Starting a pipeline that processes a corpus of files
  • Content-based deduplication is needed
  • Initial metadata (size, hash) enables early-stage filtering

Theoretical Basis

Content addressing maps each file to a stable identifier:

# Abstract algorithm (NOT real implementation)
def discover(target, extensions):
    samples = []
    for file in walk(target, extensions):
        content = file.read_bytes()
        sha256 = hashlib.sha256(content).hexdigest()
        samples.append(Sample(
            sample_id=sha256[:16],  # collision-resistant prefix
            source_path=file,
            data={"sha256": sha256, "size_bytes": len(content)},
        ))
    return samples

Related Pages

Implemented By

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment