agentleFS
DshamirDshamir/slm-forge/skills/forge-ingest/SKILL.md

forge-ingest

Skill1 starsChanged 6 months agoMITView on GitHub

Multi-source fan-out skill. Reads a config.yaml that combines N sources of 10 different kinds (local_dir, archive, http, jsonl, hf_dataset, database, git, s3, gcs, azure) and produces ONE merged prepped.jsonl ready for forge-audit. Each source is dispatched to the appropriate handler (forge-prep for files, forge-ingest-db for databases, cloud SDKs for object stores, git for repo clones). Cross-source deduplication catches the same passage appearing in multiple inputs. Within-source deduplication always runs. Supports --dry-run for cost/size preview before committing to a long-running ingest.

We split this skill into the rules it gives an agent

6 rules. About 0 are common, 2 are distinctive, and 4 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈2

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 4

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    After INGEST, the standard pipeline continues from AUDIT:

    line 14
  2. Very specific:

    All cloud sources support optional include: / exclude: glob filters applied after the listing call.

    line 77
  3. Very specific:

    When options.dedup_across_sources: true (default), a single SHA-256 set is maintained across all sources.

    line 92
  4. Very specific:

    Before fan-out begins, the skill sums the bytes of all local_dir and jsonl sources and refuses (rc=4) if free disk at $RUN_DIR is less than …

    line 123
  5. Very specific:

    If prepped.jsonl already exists in the run dir and is non-empty, the skill refuses to clobber it (rc=3).

    line 130
  6. Distinctive:

    If ALL sources fail OR the merged JSONL is empty, the skill exits 1 and the dispatcher tears down.

    line 140

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

forge-ingest

When this fires

Phase position: INGEST — first phase fired when the input is a multi-source-config.yaml (detected by forge-analyze). Replaces the single-input prep phase for multi-source runs.

After INGEST, the standard pipeline continues from AUDIT:

INGEST → AUDIT → SYNTH → SHAPE → PLAN_FIT → ... (unchanged)

Config format

version: 1
run_name: dental-pubmed-jan2026     # optional
domain: dental.ai.research           # optional override
budget_usd: 75                       # optional override

sources:
  - name: local-papers
    kind: local_dir
    path: ./Publications/
    enable_plugins: [archive, ocr]   # opt-in heavy tiers per-source

  - name: papers-archive
    kind: archive
    path: ./papers-2024.tar.gz

  - name: pubmed-snapshot
    kind: http
    url: https://example.org/pubmed-dental.jsonl
    sha256: abc...                   # optional verification

  - name: pubmed-live
    kind: database
    config: ./db-sources.yaml        # delegates to forge-ingest-db

  - name: prior-run
    kind: jsonl
    path: ./prior-runs/2025-12.jsonl

  - name: hf-corpus
    kind: hf_dataset
    repo: nlpaueb/dental-qa
    split: train
    text_field: question

options:
  dedup_across_sources: true          # default true
  min_len: 200
  max_len: 100000

Source kind: handlers

kindHandlerAuth / configAdded
local_dirprep-orchestrator (full plugin family)filesystem pathv2.2
archiveprep_plugins/archive.py (zip-slip safe)filesystem path; nested ≤ depth 3v2.2
httpurllib + sha256 verify; 3-attempt retry + mirrorsurl + optional sha256v2.2
jsonlpass-through copy (already canonical)filesystem pathv2.2
hf_datasethuggingface_hub (gated/private auth pre-check)HF_TOKEN env or token: in sourcev2.2
databasedelegates to forge-ingest-db/run.shsub-config path (10 adapter kinds inside)v2.2
gitgit clone --depth N --branch REF; full-clone fallback for SHAs; include/exclude globsurl + optional auth_token_ref for private reposv2.3
s3boto3; bucket+prefix or single key; endpoint_url for MinIOaccess_key_id_ref + secret_access_key_ref (+ optional session_token)v2.3
gcsgoogle-cloud-storage; bucket+prefix or single objectcredentials_json_path or credentials_json_refv2.3
azureazure-storage-blob; container+prefix or single blobsas_token_ref / account_key_ref / connection_string_refv2.3

All cloud sources support optional include: / exclude: glob filters applied after the listing call.

Output

slm-forge/.runs/<run-id>/prepped.jsonl — same canonical schema as single-source forge-prep. Each chunk's metadata.source_file carries the source name as prefix (<source-name>:<original-path>) so provenance survives the merge.

slm-forge/.runs/<run-id>/ingest-stats.json — per-source breakdown + cross-source dedup count.

Cross-source dedup

When options.dedup_across_sources: true (default), a single SHA-256 set is maintained across all sources. So if the same paragraph appears in:

  • a PDF in local_dir
  • the same paragraph cached in a DB row from database

…only the first occurrence wins. Source order matters — the source listed FIRST in sources: is the canonical winner; later sources lose their duplicates. Stats record which source each dup was attributed to.

Within-source dedup ALWAYS runs (catches symlink loops + duplicated files inside a single source) regardless of the dedup_across_sources setting. The hash key is text for pretrain chunks and role:content\nrole:content... for chat chunks (role differences DO matter — same prompt with different system priming does not collapse).

Dry-run

bash slm-forge/skills/forge-ingest/run.sh <run-id> --dry-run

Parses the config, validates handler dispatch for every source, sizes locally-resolvable inputs, and prints a structured plan as JSON. NO downloads, NO writes, NO prepped.jsonl produced. Use this to preview "would this S3 prefix be 10 GB or 100 GB?" or "is the HF token I set actually valid for this gated dataset?" before committing to a long run.

Returns rc=0 on a clean plan, non-zero if any handler dispatch failed.

Disk-space pre-check

Before fan-out begins, the skill sums the bytes of all local_dir and jsonl sources and refuses (rc=4) if free disk at $RUN_DIR is less than 1.5x that estimate. Cloud / HF / DB sources are not pre-sized (can't be cheaply); operators should --dry-run first if unsure.

Re-run safety

If prepped.jsonl already exists in the run dir and is non-empty, the skill refuses to clobber it (rc=3). Override with FORGE_INGEST_FORCE=1 or use a fresh run-id.

Failure policy

Per source: failures (HTTP 404, DB unreachable, archive corrupt) are logged but do not abort the overall run. Other sources continue. The final ingest-stats.json carries failures: [{source, error, ...}].

If ALL sources fail OR the merged JSONL is empty, the skill exits 1 and the dispatcher tears down.

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.