agentsclimarketplace

Kp source

Skill rangzen/knowledge-project-skills/skills/kp-source

Add sources to a knowledge project, check for updates, and track provenance. Use when the user runs /kp-source, wants to add a PDF, URL, CSV, database dump, or any document to sources/, needs to check the status of ingested sources, or wants to detect whether a previously ingested source has changed. "kps" is the short name for this project (Knowledge Project Skills) - also activate when the user says "kps ingestion" or "kps ingest".From its SKILL.md

Install
npx -y skills add rangzen/knowledge-project-skills --skill kp-source

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

2 things to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.
  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

SKILL.md

4.9 KB, ~1.2k tokens by cl100k_base, as published. Nobody here has run it

Instructions

When to activate

Activate when the user invokes /kp-source add, /kp-source status, or /kp-source check-updates, or asks to add a document or source file to the project.


Sub-commands

add <path-or-url>

If <path> is a directory:

  1. Run <skill-dir>/scripts/ingest.py --list-dir <path> to discover files. The script walks recursively (skipping hidden files and dirs), hashes each file, and checks against existing sources for duplicates. All file types are included - no extension filtering.
  2. Count files where duplicate_of is null (new files to ingest).
  3. If that count exceeds the threshold (default 50, override with --threshold N):
    Found N files. This will create N sources. Continue? [y/N]
    
    If the user answers N (or gives no answer), abort with zero sources created. Pass --yes to skip this prompt for scripted use (--threshold 0 also bypasses it).
  4. For each non-duplicate file, run the single-file ingestion steps below (derive slug, create directory, copy, run ingest.py, handle --sensitive).
  5. After all files are processed, print a summary:
    Added:      N
    Duplicate:  N  (already ingested as <source-id>)
    Failed:     N
    

If <path> is a single file or a URL:

  1. Assign a source-id slug:
    • Derive a short kebab-case slug from the filename or URL (e.g. cairn-annual-report, privacy-policy-2024).
    • For YouTube URLs, derive the slug from the video title if available, or fall back to youtube-<video-id> (e.g. youtube-dQw4w9WgXcQ).
    • Keep it concise: 2-4 meaningful words, lowercase, hyphens only.
    • Check uniqueness against existing directory names in sources/.
    • If the slug already exists, append -2, -3, etc. until unique.
  2. Create sources/<source-id>/.
  3. Fetch content into sources/<source-id>/:
    • YouTube URL (youtube.com/watch?v= or youtu.be/): run uv run <skill-dir>/scripts/fetch_youtube.py <url> sources/<source-id>/. This writes transcript.txt (timestamped plain text, one line per caption) and attempts to write <title>.info.json via yt-dlp (best-effort). The primary content file for extraction is transcript.txt.
    • Other URL: download with curl -L -o <filename>.
    • Local file: copy into the directory.
  4. Run <skill-dir>/scripts/ingest.py --source-id <source-id> --origin <path-or-url>:
    • Computes SHA-256 hash.
    • Detects type (pdf, csv, url, db-dump, markdown, image, other).
    • Reads page count for PDFs.
    • Writes sources/<source-id>/.meta.json.
  5. If --sensitive: append sources/<source-id>/ to .gitignore.
  6. Print the assigned source-id and confirm.

.meta.json schema:

{
  "source_id": "generated-source-slug",
  "origin": "<path-or-url>",
  "type": "pdf",
  "ingested_at": "<ISO datetime>",
  "hash": "sha256:<hex>",
  "page_count": 42,
  "sensitive": false,
  "extraction": {"status": "pending"},
  "stale": false
}

status

For each directory in sources/, read .meta.json and print a table:

source-idtypeoriginingested-atextraction.statusstale

check-updates

For each source in sources/:

  1. Run <skill-dir>/scripts/ingest.py --check-update --source-id <source-id>.
  2. The script recomputes the hash (or re-fetches for URLs) and compares to the stored hash.
  3. If changed: set stale: true in .meta.json and print a warning.

Flags

FlagEffect
--sensitiveAdds sources/<source-id>/ to .gitignore.
--threshold NOverride the file-count confirmation threshold (default 50). Set to 0 to disable.
--yesSkip the directory file-count confirmation prompt.

Edge cases

  • URL download fails: report the error, do not create a partial sources/<source-id>/.
  • YouTube transcript unavailable (private video, no captions): fetch_youtube.py exits non-zero; report the error and do not create a partial source directory.
  • File not found: report clearly, suggest checking the path.
  • Project not initialized (.knowledge-project missing): prompt the user to run /kp-init first.
  • Empty directory: report zero files found.
  • Duplicate file in directory input: log it in the summary (Duplicate: N) with the existing source-id; do not re-ingest.

What ships with it: 3 files

10.2 KB alongside SKILL.md, 2 of them executable

scripts/

Keep looking

Skills are one crate of 326,835. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.