Context
Sub of Phase 2 Epic #11626 (meta-Epic #11624). Graduated from Discussion #11623.
Bulk data-plane facade for initial tenant onboarding + hook bursts > MCP threshold. CLI path bypasses MCP volume gate.
The Problem
Initial tenant onboarding can be 5k-50k chunks (per ChromaDB defrag-perf anchor: ~10k chunks reasonable scale). MCP facade refuses this. Hook bursts after git push of a large refactor branch can also exceed the threshold. Bulk path is structurally necessary.
The Fix
CLI command: npm run ai:ingest-tenant <tenantId> [--from-file <path>] [--from-stdin]
Wraps KnowledgeBaseIngestionService.ingestSourceFiles (Phase 2A) with viaMcp: false:
- Reads
parsed-chunk-v1 records from file OR stdin (JSONL streaming)
- Batches into reasonable chunks (config-tunable; default 500 records)
- Streams progress to stdout
- Returns structured summary on completion
Optional V1.5 — HTTP/streaming endpoint deferred decision pending V1 deployment shape. For V1: CLI-only acceptable; HTTP can land as separate ticket if measurement justifies.
Script location: buildScripts/ai/ingest-tenant.mjs OR ai/scripts/ingest-tenant.mjs — final placement requires structural-pre-flight skill consultation at implementation time (sibling-pattern lift: ai/scripts/orchestrator-daemon.mjs precedent).
Acceptance Criteria
Out of Scope
- HTTP/streaming endpoint → potentially V1.5 (separate ticket if needed)
- MCP facade → Phase 2B
- Service-layer ingestion logic → Phase 2A (consumed here)
Related
- Parent: #11626
- Blocked-by: Phase 2A (#TBD — service layer must exist)
- Daemon-script precedent:
ai/scripts/orchestrator-daemon.mjs, swarm-heartbeat-daemon.mjs
- Discussion source: #11623 §4 Q3 + §7 Phase 2
Origin Session ID
7360e917-1733-4cdd-a6f3-5ac51c34b838
Handoff Retrieval Hints
ai/scripts/orchestrator-daemon.mjs is sibling-pattern reference for CLI tooling under ai/scripts/
buildScripts/ai/backup.mjs (#10129 precedent) is the canonical-orchestrator-script pattern for KB-side ops
- structural-pre-flight skill placement decision is the substrate-correct gate before file location commits
Context
Sub of Phase 2 Epic #11626 (meta-Epic #11624). Graduated from Discussion #11623.
Bulk data-plane facade for initial tenant onboarding + hook bursts > MCP threshold. CLI path bypasses MCP volume gate.
The Problem
Initial tenant onboarding can be 5k-50k chunks (per ChromaDB defrag-perf anchor: ~10k chunks reasonable scale). MCP facade refuses this. Hook bursts after
git pushof a large refactor branch can also exceed the threshold. Bulk path is structurally necessary.The Fix
CLI command:
npm run ai:ingest-tenant <tenantId> [--from-file <path>] [--from-stdin]Wraps
KnowledgeBaseIngestionService.ingestSourceFiles(Phase 2A) withviaMcp: false:parsed-chunk-v1records from file OR stdin (JSONL streaming)Optional V1.5 — HTTP/streaming endpoint deferred decision pending V1 deployment shape. For V1: CLI-only acceptable; HTTP can land as separate ticket if measurement justifies.
Script location:
buildScripts/ai/ingest-tenant.mjsORai/scripts/ingest-tenant.mjs— final placement requiresstructural-pre-flightskill consultation at implementation time (sibling-pattern lift:ai/scripts/orchestrator-daemon.mjsprecedent).Acceptance Criteria
npm run ai:ingest-tenantdefined inpackage.jsonparsed-chunk-v1records from--from-fileOR--from-stdinviaMcp: false)buildScripts/ai/vsai/scripts/)Out of Scope
Related
ai/scripts/orchestrator-daemon.mjs,swarm-heartbeat-daemon.mjsOrigin Session ID
7360e917-1733-4cdd-a6f3-5ac51c34b838Handoff Retrieval Hints
ai/scripts/orchestrator-daemon.mjsis sibling-pattern reference for CLI tooling underai/scripts/buildScripts/ai/backup.mjs(#10129 precedent) is the canonical-orchestrator-script pattern for KB-side ops