本文へ移動
cccskills
無料GitHub で公開

kb-ingest-bulk

Parallel map-reduce bulk ingest for large source sets. Map phase dispatches read-only knowledge-extractor agents (≤N-wide, default Haiku) emitting per-source JSON extracts; Python routes extracts by target library file (fuzzy-merging new topics, pre-allocating new files, flagging oversized topics); reduce phase dispatches one agent-knowledge-updater per file (parallel, one writer per file); single shelf-index rebuild + one log.md entry. Resumable. Supersedes kb-ingest-batch.

インストール方法を見る

含まれるファイル(1)

  • SKILL.md5.5 KB

SKILL.md(原文)

インストールする前に、エージェントに与えられる指示の中身を確認できます。

Bulk Ingestion (map-reduce)

Load a large source set into the knowledge base in parallel. Four phases: map (parallel extract) → route (Python) → reduce (parallel synthesis, one writer per file) → finalize (one rebuild + one log entry).

Arguments

ArgumentDescription
<glob|dir|file-list>Sources to ingest
--library <path>Target library, bypassing CLAUDE.md resolution (default: CLAUDE.md-resolved). For isolated testing / multi-library — see #209
--parallel <N>Concurrency for map + reduce rounds (default 16, max 64)
--extractor-model <id>Map model (default claude-haiku-4-5)
--size-threshold <tokens>Per-file reduce size guard (default 200000)
--retry-failedRe-queue failed sources/targets from a prior run
--cleanRemove library/.extracts/ after a successful run

Preflight

  1. Resolve library_path: if --library given, use it; else read CLAUDE.md ## Knowledge Base section. Derive shelf_index_path = <library>/_shelf-index.md, log_path = <library>/log.md, extracts_dir = <library>/.extracts.
  2. Verify knowledge-extractor and agent-knowledge-updater agents are available.
  3. Clamp --parallel to [1, 64].

Module bootstrap

Use this CLAUDE_PLUGIN_ROOT importlib loader block to import the sdlc_knowledge_base_scripts.kb_ingest_bulk helpers. It is self-contained — no other file needs to be opened.

python3 -c "
import sys, os, importlib.util, json
PLUGIN_ROOT = os.environ.get('CLAUDE_PLUGIN_ROOT', '')
SCRIPTS = os.path.join(PLUGIN_ROOT, 'scripts')
INIT = os.path.join(SCRIPTS, '__init__.py')
if os.path.isfile(INIT) and 'sdlc_knowledge_base_scripts' not in sys.modules:
    spec = importlib.util.spec_from_file_location(
        'sdlc_knowledge_base_scripts', INIT, submodule_search_locations=[SCRIPTS])
    if spec and spec.loader:
        mod = importlib.util.module_from_spec(spec)
        sys.modules['sdlc_knowledge_base_scripts'] = mod
        spec.loader.exec_module(mod)
from sdlc_knowledge_base_scripts.kb_ingest_bulk import (
    discover_sources, build_bulk_manifest, load_manifest, save_manifest,
    retry_failed, persist_extract, slug_for_source, mark_source_extracted,
    mark_source_failed, route_extracts, format_extract_prompt,
    format_reduce_prompt, ReduceDispatchRequest, mark_target_reduced,
    mark_target_failed, summarize_run, write_log_entry, ExtractDispatchRequest
)
"

Phase 1 — Map (parallel ≤N)

  1. discover_sources(<spec>) → source list; build_bulk_manifest(...) (merge prior manifest via load_manifest if present; retry_failed if --retry-failed); save_manifest.
  2. For each pending source whose extract file does NOT already exist (resume skip): dispatch knowledge-extractor with format_extract_prompt(...), up to N concurrently (parallel Agent-tool calls). Capture each agent's JSON reply.
  3. After each agent: persist_extract(extracts_dir, slug, json) then mark_source_extracted; on error/invalid-JSON mark_source_failed. save_manifest after each round.

Phase 2 — Route (Python, no agents)

  1. Load all extract JSON files. Compute existing_files = set of *.md in the library (excluding _shelf-index.md, log.md, _index.md, and anything under raw/).
  2. route = route_extracts(extracts, existing_files, size_threshold). Record each route.targets entry into manifest["targets"] as pending with source_count and is_new. Report route.oversized (skipped). save_manifest.

Phase 3 — Reduce (parallel ≤N, one writer per file)

  1. For each pending target: dispatch ONE agent-knowledge-updater with format_reduce_prompt(ReduceDispatchRequest(...)), up to N concurrently. Exactly one agent per file — never two agents on the same file.
  2. After each: mark_target_reduced (success) or mark_target_failed (error). save_manifest after each round.

Phase 4 — Finalize (once)

  1. Rebuild the shelf-index once via build_shelf_index.main([library_path]). Directories listed in <library>/.kb-index-ignore (plus raw/) are excluded. If it exits with code 2, the bulk-add safety rail refused the rebuild (>= 50 entries added and index >= 2x): neither _shelf-index.md nor log.md was written. Show the user the per-directory breakdown (e.g. iso20022/: 412 added) and re-run with --force only after the user confirms — never automatically. Skip step 9 until the rebuild has actually succeeded.
  2. write_log_entry(log_path, "## [<date>] ingest-bulk\n" + summarize_run(manifest, route.oversized)).
  3. Print the summary table. If --clean, remove extracts_dir.

Exit / partial failure

A failed source drops out of routing; a failed target leaves its extracts on disk for --retry-failed. Report all failures + oversized topics. Non-zero exit only if nothing succeeded.

レビュー

まだレビューはありません。使ってみた感想をお寄せください。

同じリポジトリのスキル

概要と使いどころ

Generate a GitHub Actions workflow for Android — JDK + Gradle caching, build, unit + instrumented tests, Android Lint, run the Android pre-flight checks, and (optionally) sign + upload a signed app bundle to a Play track. Use when setting up CI for an Android app.

日本語の概要は準備中です。原文の説明を表示しています。

SteveGJones/ai-first-sdlc-practices412026年10月5日 更新

Validated Google Play release — runs the pre-flight checks and clears the Play policy gates, builds a signed app bundle with a git-stamped versionCode, uploads to a track, and walks staged rollout (with halt/roll-forward). Use when releasing an Android app to Play.

日本語の概要は準備中です。原文の説明を表示しています。

SteveGJones/ai-first-sdlc-practices412026年10月5日 更新

Scaffold a new Android app with SDLC and Play-safe defaults — Kotlin/Compose Gradle project with version catalog, convention plugins, module layout, a targetSdk that meets the Play mandate, R8 on release, and git-ignored signing so it passes the pre-flight checker from day one. Use when starting a new Android project.

日本語の概要は準備中です。原文の説明を表示しています。

SteveGJones/ai-first-sdlc-practices412026年10月5日 更新

Set up Android app signing safely — generate an upload keystore, enroll in Play App Signing, and wire a Gradle release signingConfig that reads secrets from a git-ignored keystore.properties / CI (never committed). Use when configuring signing for a Play release.

日本語の概要は準備中です。原文の説明を表示しています。

SteveGJones/ai-first-sdlc-practices412026年10月5日 更新

Pick an existing workflow for a task or author a new one — recommends workflow + team formation, or generates a fresh workflow YAML with command prompts and team validation.

日本語の概要は準備中です。原文の説明を表示しています。

SteveGJones/ai-first-sdlc-practices412026年10月5日 更新

Guide the team through writing a change-impact record for IEC 62304 / FDA / ISO 26262 ASIL C+ projects. Surfaces the affected REQ/DES/TEST/CODE artefacts and captures human-attested verification approach.

日本語の概要は準備中です。原文の説明を表示しています。

SteveGJones/ai-first-sdlc-practices412026年10月5日 更新

SteveGJones のスキルをすべて見る

このスキルの問題を報告する