tiangong-kb-ingest
Skill11 starsChanged 3 months agoMITView on GitHub
Upload local files or folders into Tiangong KB through the Tiangong AI CLI. Use when a user asks an agent to ingest documents into a KB collection, list uploadable collections, or explain ingest duplicate/status results.
- Reads credentials
In this repository62 other files it gives its agents.
- AGENTS.mdAGENTS.md
- academic-paper-downloadSkill
- airnow-hourly-obs-fetchSkill
- ai-tech-fulltext-fetchSkill
- ai-tech-rss-fetchSkill
- ai-tech-summarySkill
- apply-environmental-thinkingSkill
- bluesky-cascade-fetchSkill
- convert-image-to-jpgSkill
- dify-knowledge-base-searchSkill
- dify-knowledge-base-uploadSkill
- document-granular-decomposeSkill
- domain-onboardingSkill
- eceee-news-fulltext-fetchSkill
- email-imap-appendSkill
- email-imap-fetchSkill
- email-imap-full-fetchSkill
- email-smtp-sendSkill
- epa-eis-records-fetchSkill
- federal-register-doc-fetchSkill
- fetch-abstract-to-kbSkill
- fetch-meta-from-kbSkill
- fetch-meta-to-kbSkill
- figshare-data-downloadSkill
- gdelt-doc-searchSkill
- gdelt-events-fetchSkill
- gdelt-gkg-fetchSkill
- gdelt-mentions-fetchSkill
- gdelt-web-ngrams-searchSkill
- github-contribution-period-analysisSkill
- nasa-firms-fire-fetchSkill
- notebooklmSkill
- openaq-data-fetchSkill
- open-meteo-air-quality-fetchSkill
- open-meteo-flood-fetchSkill
- open-meteo-historical-fetchSkill
- regulationsgov-attachments-fetchSkill
- regulationsgov-comment-detail-fetchSkill
- regulationsgov-comments-fetchSkill
- remove-similar-imageSkill
- river-outfall-status-visualizerSkill
- sustainability-fulltext-fetchSkill
- sustainability-rss-fetchSkill
- sustainability-summarySkill
- synology-file-stationSkill
- tiangong-auto-researchSkill
- tiangong-auto-research-workbuddySkill
- tiangong-kb-course-fulltext-fetchSkill
- tiangong-kb-course-searchSkill
- tiangong-kb-edu-searchSkill
- tiangong-kb-esg-searchSkill
- tiangong-kb-patent-searchSkill
- tiangong-kb-report-searchSkill
- tiangong-kb-sci-searchSkill
- tiangong-kb-textbook-searchSkill
- tsinghua-graduate-thesisSkill
- usbr-project-records-fetchSkill
- usbr-rise-fetchSkill
- use-thuenv-presentation-styleSkill
- usgs-water-iv-fetchSkill
- The first 60 shown.
The file
Show its rules and text
We split this skill into the rules it gives an agent
15 rules. About 0 are common, 10 are distinctive, and 5 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈10
Distinctive · estimate
This author's own choices. Worth a look.
5
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Very specific: line 10
Use the Tiangong AI CLI through the exact reviewed entrypoint npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai by default, so …
- Distinctive: line 30
run CLI metadata dry-run before bulk run and pass the generated metadata map into bulk ingest
- Distinctive: line 32
keep backend secrets and storage/search systems out of the agent workflow
- Very specific: line 38
prefer --collection-name or TIANGONG_KB_DEFAULT_COLLECTION_NAME when the user gives a unique display name
- Very specific: line 39
use --collection-key, --collection-path, or --collection-id only when the user provides an exact selector
- Distinctive: line 47
call CLI collection schema through the Tiangong KB ingest API
- Distinctive: line 48
call CLI bulk scan for folder structure
- Distinctive: line 49
write a layered metadata map with base filesystem fields plus conservative domain/detector rules
- Distinctive: line 50
run CLI metadata dry-run against the generated map
- Very specific: line 53
If the user asks to verify later state, use npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest status …
- Very specific: line 58
When generating metadata-map.yaml, start from this conservative layered map and add only collection-specific fields that the schema …
- Distinctive: line 120
Use an existing metadata map:
- Distinctive: line 126
Use a metadata map saved at a specific path:
- Distinctive: line 138
Read a collection schema through the API:
- Distinctive: line 161
Never ask for or use:
≈ “Common” is an estimate: at least 1 in 5 of the 213,897 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.
Files
Tiangong KB Ingest
Boundary
Use the Tiangong AI CLI through the exact reviewed entrypoint npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai by default, so users do not need a preinstalled CLI. The agent may orchestrate CLI schema, scan, metadata dry-run, and bulk commands, but it must not call backend databases or storage systems directly.
CLI-owned behavior:
tiangong-ai kb ingest bulktiangong-ai kb ingest bulk scantiangong-ai kb ingest metadata dry-runtiangong-ai kb ingest statustiangong-ai kb collections listtiangong-ai kb collections schema- SQLite checkpoint and resume
- concurrency/retry
- JSON output
- API key and env handling
Skill-owned behavior:
- choose this workflow when the user wants to upload local files/folders into Tiangong KB
- choose the safest collection selector
- generate a conservative
rule_mode: layeredmetadata map from collection schema plus folder scan when the user did not pass--metadata-map - run CLI metadata dry-run before bulk run and pass the generated metadata map into bulk ingest
- explain returned
duplicate,existingDocumentId, document status, job id, request id, and idempotency key - keep backend secrets and storage/search systems out of the agent workflow
Short Workflow
- Confirm the local file or folder path exists.
- Pick one collection selector:
- prefer
--collection-nameorTIANGONG_KB_DEFAULT_COLLECTION_NAMEwhen the user gives a unique display name - use
--collection-key,--collection-path, or--collection-idonly when the user provides an exact selector
- prefer
- Load dotenv defaults from the target path directory when present:
- for a file, read
.envfrom the file's parent directory - for a folder, read
.envfrom that folder - loaded dotenv values fill only unset environment variables; explicit user inputs passed as CLI flags take precedence
- for a file, read
- For a first check, run
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb collections list --json. - For bulk/upload runs without
--metadata-map, generatemetadata-map.yaml:- call CLI collection schema through the Tiangong KB ingest API
- call CLI bulk scan for folder structure
- write a layered metadata map with base filesystem fields plus conservative domain/detector rules
- run CLI metadata dry-run against the generated map
- Ingest with
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest bulk <path> --json; pass--metadata-map metadata-map.yamlunless a metadata map is already provided or the user explicitly asks to skip metadata-map generation. - For long runs, tune
--window-size,--top-up-max,--upload-concurrency,--retries, and--state; do not add--max-pollsunless the user explicitly wants a bounded monitoring run. - If the user asks to verify later state, use
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest status <document-id-or-job-id> --json. - Report only current CLI output and backend response fields. Do not infer success from direct database queries.
Metadata Map Minimum
When generating metadata-map.yaml, start from this conservative layered map
and add only collection-specific fields that the schema requires:
version: 1
rule_mode: layered
defaults:
source: local_bulk_upload
layers:
- name: base
merge: all
rules:
- name: filesystem
match:
glob: "**/*"
fields:
relative_path:
source: relative_path
filename:
source: filename
filename_stem:
source: filename_stem
ext:
source: ext
path_depth:
source: path_depth
top_dir:
source: top_dir
parent_dir:
source: parent_dirFor required schema fields not covered by path rules, add safe defaults under
defaults: prefer other when it is an enum value, otherwise the first enum
value, 0 for numbers, false for booleans, 1970-01-01 for dates, and
unknown for strings.
Validate before upload:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest bulk scan /path/to/folder --json
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb collections schema --collection-key course/thu_humanities --json
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest metadata dry-run /path/to/folder --metadata-map metadata-map.yaml --jsonFor offline validation with a captured schema, pass
--schema-file schema.json to metadata dry-run.
Examples
Upload one file:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest bulk /path/to/document.pdf --jsonUpload a folder:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest bulk /path/to/folder --upload-concurrency 3 --retries 3 --jsonUse an existing metadata map:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest bulk /path/to/folder --metadata-map metadata-map.yaml --jsonUse a metadata map saved at a specific path:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest bulk /path/to/folder --metadata-map course-map.yaml --jsonList uploadable collections:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb collections list --capability upload --jsonRead a collection schema through the API:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb collections schema --collection-key course/thu_humanities --jsonCheck document status:
npx --yes --package "@tiangong-ai/cli@0.0.48" -- tiangong-ai kb ingest status <document-id> --jsonResult Interpretation
duplicate: true: the backend found an active existing document with the same dedupe identity. Tell the user the upload was treated as duplicate and showexistingDocumentIdwhen present.duplicate: falseor missing: do not claim dedupe was checked unless the backend response says so.documentId: use this id for follow-up status checks.status: explain it as backend state. Terminal states are success/failure/deleted according to the API response; nonterminal states mean processing is still underway.jobId,statePath,requestId,idempotencyKey,rawUri: include them when present because they help support/debugging.metadata-map.yaml: explain it as a reusable layered rules file. It is not per-file metadata; CLI evaluates the same rule file for each file.
Safety Boundary
Never ask for or use:
- Supabase URL, anon key, service-role key, email/password, or session cookies
- NAS credentials or raw storage paths
- AWS, Pinecone, or OpenSearch admin credentials
- direct SQL/database queries to verify the current upload
The backend owns authorization, collection permission checks, duplicate detection, raw canonical write, document reservation, parse queueing, and status transitions. Read references/env.md only when environment setup or security boundaries matter.
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
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.

