Skip to content

feat(ingest): submit async extraction batches from the ingest loop (#430) - #434

Merged
CheeryProgrammer merged 1 commit into
mainfrom
feat/430-batch-ingest
Jul 20, 2026
Merged

feat(ingest): submit async extraction batches from the ingest loop (#430)#434
CheeryProgrammer merged 1 commit into
mainfrom
feat/430-batch-ingest

Conversation

@CheeryProgrammer

Copy link
Copy Markdown
Contributor

What & why

Closes #430 — completes #420's ingest wiring. Opt-in (EXTRACTION_BATCH), sync path unchanged by default.

With EXTRACTION_BATCH + the Claude extractor, ingest's extractor step now submits the document's hot chunks as one Message Batch (SubmitExtractionBatch, custom_id = content hash, deduped) instead of extracting synchronously per chunk — so a bulk import defers node/edge creation to kb poll-batches (cron) at ~50% of the API cost.

Test

TestIngestSubmitsBatch (DB + capturing mock): ingest submits a batch and writes no graph, then poll-batches applies the extraction (nodes appear). gofmt/vet/golangci-lint clean. SYSTEM.md (§10) updated.

🤖 Generated with Claude Code

)

Completes #420's ingest wiring. With EXTRACTION_BATCH + the Claude
extractor (c.batchExtractor set), ingest's extractor step submits the
document's hot chunks as one Message Batch (SubmitExtractionBatch,
custom_id = content hash, deduped) instead of extracting synchronously
per chunk — so a bulk import defers node/edge creation to `kb
poll-batches` (cron) at ~50% of the API cost.

IngestStats.BatchesSubmitted counts it; ExtractedNodes/Edges stay 0 for
that document (the graph is written at poll time). The synchronous path
is unchanged when batch mode is off (default). Batches are per-document;
coalescing across a run is a minor future optimization. Cross-doc entity
resolution remains #431.

Test: TestIngestSubmitsBatch (DB + capturing mock) — ingest submits a
batch and writes no graph, then poll-batches applies the extraction.

Closes #430

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@CheeryProgrammer
CheeryProgrammer merged commit 0f34cd0 into main Jul 20, 2026
5 checks passed
@CheeryProgrammer
CheeryProgrammer deleted the feat/430-batch-ingest branch July 20, 2026 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Wire async batch submit into the ingest loop (follow-up to #420 part 1)

1 participant