AI & Documents
Model access, rules, OCR and bounding-box document analysis, synthetic data. Captured from kis --help, so this matches the binary rather than describing it.
kis ai
Section titled “kis ai”AI commands backed by lib-ai. See kis ai <command> --help.
kis ai [command]| Subcommand | Purpose |
|---|---|
chat | Send a prompt to a model and print the reply |
chunk | Split a document into chunks |
embed | Embed text and print vectors (or a similarity matrix) |
extract | Extract structured fields from text, with N-run consensus |
harness | Run and inspect agentic harness definitions (lib-ai-harness) |
image | Generate image(s) from a text prompt |
memory | Interact with the ai-smriti memory service over HTTP |
models | List the models a provider advertises (with capabilities) |
providers | List supported providers and their capabilities |
rag | Retrieval-augmented generation over a vector store |
reason | Run a reasoning strategy (CoT, Tree-of-Thoughts, Reflexion, Debate, …) |
rerank | Rerank documents by relevance to a query |
sample | Multi-sample / multi-model strategies (dev comparison tool) |
session | Persistent multi-turn conversations (file-backed) |
solve | Generate a JavaScript program for the task and execute it in maya (deterministic) |
structured | Get schema-constrained JSON output from a model |
tokens | Count tokens for text (heuristic, or exact via a local server) |
transcribe | Transcribe an audio file to text (STT) |
tts | Synthesize speech from text |
kis ai chat
Section titled “kis ai chat”Send a prompt to a model via lib-ai and print the reply.
The prompt comes from the arguments, or from stdin when no arguments are given.
Examples: kis ai chat “what is 2+2?” kis ai chat -p openai -m gpt-4o “summarize this” echo “translate to French: hello” | kis ai chat kis ai chat —stream “write a haiku about go” kis ai chat -p ollama -m qwen3-vl:8b -I photo.jpg “what is in this image?” kis ai chat —prompt-file prompts.yaml —prompt summarize —vars [email protected] kis ai chat —session proj-42 “remember my name is Sam” # saved + resumable kis ai chat -i —session proj-42 # interactive, resumes proj-42
Interactive mode (-i): each line sends on Enter. Start a heredoc with <<EOF to
compose a multi-line message (lines collected until a line equal to the
delimiter). Slash commands: /image <path|url> and /file
kis ai chat [text] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-I, --image stringArray | image file path or http(s) URL for vision models (repeatable) |
-i, --interactive | interactive multi-turn REPL (streamed) |
-j, --json | print the full response as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
-s, --system string | system prompt |
-T, --temperature float | sampling temperature (omit for provider default) (default -1) |
-v, --vars stringArray | template var key=value (repeatable); value may be @file or @- to read stdin |
kis ai chunk
Section titled “kis ai chunk”Split a document into chunks using a lib-ai chunker.
Strategies: recursive (default), window, markdown, html, semantic. The semantic strategy embeds sentences to find topic boundaries and uses the provider/model flags for the embedder.
Examples: kis ai chunk README.md —strategy markdown —max-tokens 512 kis ai chunk paper.txt —strategy semantic -p ollama -m nomic-embed-text kis ai chunk notes.txt —strategy recursive —overlap 64 —json
kis ai chunk <file> [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print chunks as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai embed
Section titled “kis ai embed”Embed one or more inputs via lib-ai. Each argument is one input; with no arguments, inputs are read one-per-line from stdin.
Examples: kis ai embed “hello world” kis ai embed -p openai -m text-embedding-3-small “a” “b” —compare printf “first\nsecond\n” | kis ai embed —json
kis ai embed [text...] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print vectors as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai extract
Section titled “kis ai extract”Extract structured fields from input text. With —schema, output conforms to that JSON Schema (provider-native structured output + validate/repair); without it, the model returns a free-form JSON object and voting runs over the keys it emits. With —runs > 1, each run is extracted independently and the result is decided by PER-FIELD majority vote, reporting how many runs agreed on each field.
Input is assembled, in order, from: —file (one or more paths or globs), —input (literal text, or @path to read a file), positional args, or stdin. For HTML/hOCR, clean it first to save tokens: —strip-html flattens to plain text, or —strip-attrs keeps the tags but drops noisy attributes (bbox, confidence, ids) so the model still sees the line/word/paragraph structure.
To focus the model on one region, —start/—end (or a prompt entry’s start/end) send only the text between the first matching start marker and the following end marker — useful to disambiguate a single section of a large document.
Examples: kis ai extract —schema loan.json —file ./application.txt —runs 5 kis ai extract —schema loan.json —file ‘pages/*.hocr’ —strip-attrs —runs 5 kis ai extract —file doc.txt —start “1e. Income from Other Sources” —end “Section 2:” echo “$DOC” | kis ai extract —schema fields.json -p openai —runs 3 —json kis ai extract —schema loan.json —prompt-file prompts.yaml —prompt extract_note —file note.txt —runs 5
kis ai extract [text] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-f, --file stringArray | input file path or glob (repeatable); contents are read and concatenated |
-i, --input string | input text, or @path to read a file |
-j, --json | print consensus + agreement as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
-n, --runs int | number of extraction runs for consensus voting (default 1) |
-s, --system string | system prompt |
-T, --temperature float | sampling temperature (defaults to 0.4 when runs>1) (default -1) |
-v, --vars stringArray | template var key=value (repeatable); value may be @file or @- to read stdin |
kis ai harness
Section titled “kis ai harness”Execute harness definitions with the embedded engine, validate their graphs (including the cycle boundedness rule), inspect the (desugared) graph, and resume suspended or interrupted runs from snapshots.
Model refs in definitions resolve dev-style: “provider:model” builds that provider from flags/env keys (ANTHROPIC_API_KEY, OPENAI_API_KEY, …, KIS_LOKI_KEY for gateway:); a bare ref uses —provider/—model.
kis ai harness [command]| Subcommand | Purpose |
|---|---|
graph | Emit a harness definition’s graph |
resume | Resume a suspended or interrupted run from a snapshot |
run | Execute a harness definition with the embedded engine |
validate | Parse, expand, and validate a harness definition |
kis ai image
Section titled “kis ai image”Generate images via an image-capable provider (openai, stability).
Examples: kis ai image -p openai “a watercolor fox” -o fox.png kis ai image -p stability “an isometric office” —width 1024 —height 1024
kis ai image <prompt> [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-m, --model string | model id (provider-specific; defaults per command) |
-o, --out string | output file (or prefix when —n > 1); default image.png |
-p, --provider string | provider: ollama |
kis ai memory
Section titled “kis ai memory”HTTP client for ai-smriti (ai-memory): the platform’s interaction memory.
Write path: start · append · close · event Read path: recall · history · facts Scoping: promote (share a session/episode to a team scope) Governance: forget · edit · exclude Admin: consolidate
The CPET (customer:product:env:tenant) is sent as X-Customer/X-Product/X-Env/ X-Tenant headers; pass —token for the JWT and —scope-claim for the signed scope-claim when the service enforces them. Endpoint and CPET default from the KIS_SMRITI_ENDPOINT / KIS_CUSTOMER / KIS_PRODUCT / KIS_ENV / KIS_TENANT env vars.
kis ai memory [command]| Subcommand | Purpose |
|---|---|
append | Durably record a turn into a session |
close | End a session (triggers T1 consolidation) |
edit | Correct/add/delete a memory (user edits take precedence) |
event | Record a memory-relevant event |
exclude | Add a per-scope “do not remember X” exclusion |
facts | List facts about a subject (current, or as-of a time) |
forget | Erase memory and propagate the deletion (right-to-forget) |
history | Print a session’s recent history, oldest-first |
promote | Re-tag a session or episode to a (team) scope |
recall | Recall ranked, budget-fit memory across scopes |
start | Open a memory session for a subject under an owner scope |
| Flag | Purpose |
|---|---|
-e, --endpoint string | smriti service base URL (default “http://localhost:8080”) |
kis ai models
Section titled “kis ai models”List the models a provider offers, with capabilities.
Cloud providers list their declared catalog. For ollama, the locally-installed models are listed live via /api/tags (with an inferred kind: chat/code/vision/ embed). vllm/llamacpp ship no catalog — pass —model and call directly.
Examples: kis ai models -p ollama # locally installed models kis ai models -p anthropic kis ai models -p openai —json
kis ai models [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai providers
Section titled “kis ai providers”List supported providers and their capabilities
kis ai providers [flags]| Flag | Purpose |
|---|---|
-j, --json | print as JSON |
kis ai rag
Section titled “kis ai rag”Ingest documents into a vector store, retrieve context, and answer questions grounded in that context — built on lib-ai/rag.
The store is chosen by —dsn: memory: in-process (per command; not shared across runs) pgvector://user:pass@host/db Postgres + pgvector chroma://host:8000 Chroma qdrant://host:6333 Qdrant duckdb:///path/to.db DuckDB (only if the binary was built -tags duckdb)
Cross-command RAG (ingest then answer) needs a persistent DSN (pgvector/chroma/ qdrant/duckdb-file); memory: lives only for one command.
Examples:
kis ai rag ingest —dsn “pgvector://app:app@localhost:5432/kb?sslmode=disable”
—collection notes -p ollama —embed-model nomic-embed-text notes/*.md
kis ai rag answer —dsn “pgvector://app:app@localhost:5432/kb?sslmode=disable”
—collection notes -p ollama -m llama3.2:3b “what did we decide about X?”
kis ai rag [command]| Subcommand | Purpose |
|---|---|
answer | Retrieve context and answer the query, grounded in the store |
ingest | Chunk, embed and store documents (files as args, or text on stdin) |
retrieve | Retrieve the most relevant chunks for a query |
| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | JSON output |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai reason
Section titled “kis ai reason”Run a prompt through a reasoning strategy from lib-ai.
Prompt strategies (single model call, structured prompting): cot chain-of-thought (“think step by step”) structured-cot phased CoT (—phases “understand,plan,solve,verify”) plan-and-solve plan-and-solve prompting
Iterative algorithms (multiple model calls): tot Tree-of-Thoughts: branch + judge + beam search (—width —depth —beam, —judge) reflexion generate -> critique -> revise (—rounds, —judge as critic) self-refine single-model reflexion (—rounds) debate N models argue, a judge decides (—models, —judge, —rounds)
—trace prints the reasoning trace (tot/reflexion/self-refine/debate).
These strategies make the model THINK IN PROSE — they do no arithmetic. For calculations or data tasks (e.g. “how many tons of X”), use ‘kis ai solve’, which writes and executes a program. Quality is bound by the model: the iterative modes need a capable one (pass -m; the ollama default llama3.2:3b is too small for tot/reflexion/debate).
Examples: kis ai reason —mode cot “If a train travels 60km in 1.5h, its speed?” kis ai reason —mode tot —width 3 —depth 3 “Solve the 24 game with 4 6 7 8” kis ai reason —mode reflexion —rounds 3 “Write a precise definition of overfitting” kis ai reason —mode debate —models “openai:gpt-4o,anthropic:claude-sonnet-4-6” “Is P=NP likely?”
kis ai reason [prompt] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai rerank
Section titled “kis ai rerank”Rerank documents via a rerank-capable provider (cohere, tei).
Examples: kis ai rerank -p cohere “best laptop for dev” “MacBook Pro” “Chromebook” “ThinkPad” kis ai rerank -p tei -e http://localhost:8080 “query” “doc a” “doc b” —top-n 1
kis ai rerank <query> <document>... [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print results as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai sample
Section titled “kis ai sample”Run a prompt through a sampling strategy:
self-consistency call one model N times, majority-vote the answer best-of-n sample N candidates, judge the best cross-provider send to several models, judge the best (—models) race call several models, return the first to finish (—models)
—models is a comma-separated list of provider:model refs.
Examples: kis ai sample —mode self-consistency -n 5 “tricky reasoning question” kis ai sample —mode cross-provider —models “openai:gpt-4o,anthropic:claude-sonnet-4-6” ”…” kis ai sample —mode race —models “groq:llama-3.3-70b-versatile,openai:gpt-4o-mini” ”…”
kis ai sample [prompt] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-m, --model string | model id (provider-specific; defaults per command) |
-n, --n int | number of samples (self-consistency, best-of-n) (default 5) |
-p, --provider string | provider: ollama |
kis ai session
Section titled “kis ai session”Manage file-backed conversations under ~/.kisai/ai/sessions.
kis ai session [command]| Subcommand | Purpose |
|---|---|
list | List stored conversations |
new | Create a new conversation id |
send | Append a message to a conversation and print the reply |
show | Print a conversation’s messages |
kis ai solve
Section titled “kis ai solve”Have the model WRITE a small JavaScript program for the task, then execute it in the the script engine engine and print the program’s result. The model plans; the engine computes — no arithmetic hallucinations.
Security: by default the script runs in a PURE sandbox (plain JavaScript only — no file, network, or shell access). Namespaces are opted in with —allowed and enforced by the engine itself, not just the prompt:
kis ai solve “how many r letters are in the word strawberry” kis ai solve —allowed file “mean, median and mode of the salary column in /tmp/pay.csv” kis ai solve —allowed file,db “join users.csv and orders.csv on id; top 5 by total” cat data.txt | kis ai solve “median of the numbers in this list” # stdin → ‘input’ var
Posture: the generated code is printed and you are asked before it executes. —exec skips the confirmation (code still shown); —silent also hides the code; —dry-run prints the code and never executes. With —attempts N > 1, script errors are fed back to the model to fix its code and retry.
Tip: a code model generates better programs, e.g. -m qwen3-coder:30b (ollama).
kis ai solve [task] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print the result as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai structured
Section titled “kis ai structured”Produce JSON conforming to a JSON Schema. Input is args or stdin; the schema is a file path or inline JSON via —schema.
Examples: kis ai structured —schema person.json “John Smith, 42, lives in NYC” echo “$INVOICE” | kis ai structured —schema ./invoice.json -p openai kis ai structured —schema fields.json —prompt-file prompts.yaml —prompt parse_invoice —vars [email protected]
kis ai structured [text] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
-s, --system string | system prompt |
-v, --vars stringArray | template var key=value (repeatable); value may be @file or @- to read stdin |
kis ai tokens
Section titled “kis ai tokens”Count tokens for the given text (args, —file, or stdin).
By default this is lib-ai’s heuristic counter (a safe slight over-estimate). For an EXACT count against a local model, use —exact with -p llamacpp pointed at a llama.cpp server (uses its native /tokenize).
Examples: kis ai tokens “how many tokens is this?” kis ai tokens —file ./prompt.txt -p openai -m gpt-4o kis ai tokens —exact -p llamacpp -e http://localhost:8080/v1 —file big.txt
kis ai tokens [text] [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print result as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai transcribe
Section titled “kis ai transcribe”Transcribe audio via an STT-capable provider (openai, groq, deepgram, whispercpp).
Examples: kis ai transcribe -p openai call.mp3 kis ai transcribe -p whispercpp -e http://localhost:8080/v1 audio.wav —json kis ai transcribe -p groq -m whisper-large-v3 interview.m4a —timestamps
kis ai transcribe <audio-file> [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-j, --json | print full result (text + segments) as JSON |
-m, --model string | model id (provider-specific; defaults per command) |
-p, --provider string | provider: ollama |
kis ai tts
Section titled “kis ai tts”Synthesize speech via a TTS-capable provider (openai, deepgram).
Examples: kis ai tts -p openai “hello there” —voice alloy -o hello.mp3 echo “good morning” | kis ai tts -p deepgram -o gm.mp3
kis ai tts <text> [flags]| Flag | Purpose |
|---|---|
-k, --api-key string | API key (else env var, e.g. OPENAI_API_KEY) |
-e, --endpoint string | override the provider endpoint/base URL |
-m, --model string | model id (provider-specific; defaults per command) |
-o, --out string | output audio file; default speech. |
-p, --provider string | provider: ollama |
kis rules
Section titled “kis rules”execute rules on json files in a directory
kis rules [flags]| Flag | Purpose |
|---|---|
-b, --bbox strings | bounding box json file to inject. Format: [key=]filepath (default key: bbox) |
-f, --facts strings | facts to be passed to the engine as json file. Pass key and filename, separated by = |
-i, --input string | input directory with json files to be processed (default ”.”) |
-k, --key string | key under which to add the result. by default it will add to root of json file |
-o, --output string | output directory to write result json files. Same as input, if not provided. |
-p, --pattern string | glob pattern for the file to be processed (default “*.json”) |
-R, --recursive | recursively search for rule files in subdirectories |
-r, --rules strings | a single rule file or directory with rules |
-v, --vars strings | variables to inject into the rules engine as key=value pairs |
-w, --workers int | number of workers for parallel rule execution (default 1) |
kis bbox
Section titled “kis bbox”Commands for loading and analyzing bbox/OCR documents.
Each command loads one or more bbox files, treating each as a page, and performs analysis operations on the combined document.
Subcommands: tables - Detect and print all tables from bbox files table - Find and print a single table near an anchor text phrase - Search for a phrase and print locations with context snippet - Extract text between a starting and ending phrase snippets - Extract multiple named snippets as JSON
kis bbox [command]| Subcommand | Purpose |
|---|---|
phrase | Search for a phrase and print locations with context |
snippet | Extract text between a starting and ending phrase |
snippets | Extract multiple named snippets from bbox files |
table | Find and print a single table near an anchor text |
tables | Detect and print all tables from bbox files |
kis bbox phrase
Section titled “kis bbox phrase”Search for a phrase in bbox files and print all occurrences with location and context.
The search is case-sensitive by default and handles multi-word phrases. For each match, it shows the page, bounding box location, and surrounding lines for context.
Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).
Use —before (-B) and —after (-A) to control how many context lines to show. Use —case-insensitive to ignore case when matching.
Use —fuzzy to enable fuzzy matching with Levenshtein distance, which helps find phrases with OCR spelling errors. Control the tolerance with —max-dist-word (per word) and —max-dist-total (total for phrase).
Examples: kis.ai bbox phrase -p “Invoice Number” doc.bbox kis.ai bbox phrase -p “Invoice Number” .bbox kis.ai bbox phrase -p “invoice number” —case-insensitive doc.bbox kis.ai bbox phrase -p “total amount due” -B 5 -A 2 doc.bbox kis.ai bbox phrase -i page1.bbox -i page2.bbox -p “signature required” -f json kis.ai bbox phrase -p “Inviice Numbr” —fuzzy doc.bbox kis.ai bbox phrase -p “signature” —fuzzy —case-insensitive 105718727*.bbox
kis bbox phrase [files...] [flags]| Flag | Purpose |
|---|---|
-A, --after int | number of lines after match to show (default 3) |
-B, --before int | number of lines before match to show (default 3) |
-f, --format string | output format: text, json (default “text”) |
-i, --input stringArray | path to bbox file (can be specified multiple times) |
-o, --output string | output file path (defaults to stdout) |
-p, --phrase string | phrase to search for |
kis bbox snippet
Section titled “kis bbox snippet”Extract all text between a starting phrase and an ending phrase from bbox files.
The starting phrase is included in the output, while the ending phrase is excluded by default (use —include-end to include it). The extraction works across page boundaries.
Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).
Examples: kis.ai bbox snippet -s “Section 5:” -e “Section 6:” doc.bbox kis.ai bbox snippet -s “TERMS AND CONDITIONS” -e “SIGNATURE” *.bbox kis.ai bbox snippet -s “start” -e “end” —case-insensitive doc.bbox kis.ai bbox snippet -s “BEGIN” -e “END” —include-end -f json doc.bbox
kis bbox snippet [files...] [flags]| Flag | Purpose |
|---|---|
-e, --end string | ending phrase (excluded from output by default) |
-f, --format string | output format: text, json (default “text”) |
-i, --input stringArray | path to bbox file (can be specified multiple times) |
-o, --output string | output file path (defaults to stdout) |
-s, --start string | starting phrase (included in output) |
kis bbox snippets
Section titled “kis bbox snippets”Extract multiple text snippets between starting and ending phrases from bbox files.
Each snippet is defined using —snip with the format “name|start phrase|end phrase”. The output is a JSON object where keys are the snippet names and values are the extracted text.
Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).
Examples: kis.ai bbox snippets —snip “section8|Section 8:|Section 9:” doc.bbox kis.ai bbox snippets —snip “terms|TERMS AND CONDITIONS|SIGNATURE” —snip “privacy|PRIVACY|END” *.bbox kis.ai bbox snippets —snip “intro|Introduction|Chapter 1” —case-insensitive doc.bbox
kis bbox snippets [files...] [flags]| Flag | Purpose |
|---|---|
-i, --input stringArray | path to bbox file (can be specified multiple times) |
-o, --output string | output file path (defaults to stdout) |
kis bbox table
Section titled “kis bbox table”Load bbox files, find a table near the specified anchor text, and print it.
Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).
The —anchor flag specifies text to search for, and the nearest table to that text will be returned.
Optionally use —header flags to validate that the table contains expected column headers.
Examples: kis.ai bbox table -a “Invoice Items” doc.bbox kis.ai bbox table -a “Invoice Items” *.bbox kis.ai bbox table -a “Price List” -H “Item” -H “Price” -H “Qty” doc.bbox kis.ai bbox table -a “Summary” -f json -o table.json doc.bbox
kis bbox table [files...] [flags]| Flag | Purpose |
|---|---|
-a, --anchor string | anchor text to find table near |
-f, --format string | output format: text, json, csv (default “text”) |
-H, --header stringArray | expected column header (can be specified multiple times for validation) |
-i, --input stringArray | path to bbox file (can be specified multiple times) |
-o, --output string | output file path (defaults to stdout) |
kis bbox tables
Section titled “kis bbox tables”Load multiple bbox files, treat each as a page, detect all tables, and print them.
Input files can be specified as positional arguments (supports shell glob patterns) or using the -i flag (can be repeated).
Examples: kis.ai bbox tables page1.bbox page2.bbox kis.ai bbox tables *.bbox kis.ai bbox tables -i page1.bbox -i page2.bbox kis.ai bbox tables doc.json -f json kis.ai bbox tables *.bbox -f csv kis.ai bbox tables doc.bbox -o tables.txt
kis bbox tables [files...] [flags]| Flag | Purpose |
|---|---|
-f, --format string | output format: text, json, csv (default “text”) |
-i, --input stringArray | path to bbox file (can be specified multiple times) |
-o, --output string | output file path (defaults to stdout) |
kis ocr
Section titled “kis ocr”Execute rules on OCR data where each page is a .json file (facts) paired with a matching .bbox file (bounding boxes), resolved by basename.
Pass prefixes (or .json/.bbox file paths — the extension is stripped) as
positional arguments. For each prefix, both
Subcommands: page Run rules independently on each prefix (one execution per page). doc Aggregate all prefixes into a single document — facts become an array and bbox files merge into a single multi-page bbox doc — and run rules once.
kis ocr [command]| Subcommand | Purpose |
|---|---|
doc | aggregate prefixes into one document and run rules once |
page | run rules on each prefix independently (one execution per page) |
kis ocr doc
Section titled “kis ocr doc”Aggregate all prefixes into a single document and run rules once. The per-page .json files are injected as an array under —facts-key (default “pages”), and the .bbox files are merged into a single multi-page bbox document with sequentially renumbered pages, injected under —bbox-name (default “doc”).
Positional arguments may be:
- a name prefix (resolved against -i)
- a .json or .bbox file path (extension stripped)
- a directory (globbed with -p, default “*.json”)
If no positional args are given, the -i directory itself is globbed with -p. Duplicates are removed.
Examples: kis ocr doc -r rules.grl page1 page2 page3 kis ocr doc -r rules/ pages/*.json kis ocr doc -r rules/ pages/ # all .json in pages/ kis ocr doc -r rules/ -i pages/ # same, via -i kis ocr doc -r rules/ -i pages/ -p “page.json” # custom glob kis ocr doc -r rules/ -o result.json pages/ kis ocr doc -r rules/ —facts-key documents pages/
kis ocr doc [prefix|file|dir]... [flags]| Flag | Purpose |
|---|---|
-f, --facts strings | extra facts files (key=path or path) |
-i, --input string | base directory for resolving prefix files (also used when no positional args are given) (default ”.”) |
-k, --key string | key under which to add the rule result |
-o, --output string | output file (doc) or directory (page); stdout/in-place if not set |
-p, --pattern string | glob pattern (basename, e.g. “page*.json”) used when a positional arg is a directory or when no positional args are given (default “*.json”) |
-r, --rules strings | rule file or directory with rules |
-v, --vars strings | extra variables to inject (key=value) |
kis ocr page
Section titled “kis ocr page”Run rules independently for each prefix. For each prefix, both
Positional arguments may be:
- a name prefix (resolved against -i)
- a .json or .bbox file path (extension stripped)
- a directory (globbed with -p, default “*.json”)
If no positional args are given, the -i directory itself is globbed with -p. Duplicates are removed.
Examples: kis ocr page -r rules.grl page1 kis ocr page -r rules/ page1 page2 page3 kis ocr page -r rules/ pages/*.json kis ocr page -r rules/ pages/ # all .json in pages/ kis ocr page -r rules/ -i pages/ # same, via -i kis ocr page -r rules/ -i pages/ -p “page.json” # custom glob kis ocr page -r rules/ -i data/ -o results/ page1 page2 kis ocr page -r rules/ —update pages/
kis ocr page [prefix|file|dir]... [flags]| Flag | Purpose |
|---|---|
-f, --facts strings | extra facts files (key=path or path) |
-i, --input string | base directory for resolving prefix files (also used when no positional args are given) (default ”.”) |
-k, --key string | key under which to add the rule result |
-o, --output string | output file (doc) or directory (page); stdout/in-place if not set |
-p, --pattern string | glob pattern (basename, e.g. “page*.json”) used when a positional arg is a directory or when no positional args are given (default “*.json”) |
-r, --rules strings | rule file or directory with rules |
-v, --vars strings | extra variables to inject (key=value) |
-w, --workers int | number of workers for parallel page execution (default 1) |
kis hocr2bbox
Section titled “kis hocr2bbox”convert hocr to bounding box json file
kis hocr2bbox [flags]| Flag | Purpose |
|---|---|
-i, --input string | path to hocr file or directory containing hocr files |
-o, --output string | output file (for single file input) or directory (for directory input); defaults to input location |
-v, --verbose | enable verbose mode to warn about potentially missed content |
-w, --workers int | number of parallel workers for directory processing (default 4) |
kis synthetic
Section titled “kis synthetic”this command provides multiple options to generate synthetic data of various forms
kis synthetic [command]| Subcommand | Purpose |
|---|---|
float32 | generates random float32 number(s) based on different flags |
fuzzysentence | generates random fuzzy sentence(s) based on a given template |
fuzzyword | generates random fuzzy word(s) based on a given template |
int | generates random integer(s) based on different flags |
sentence | generates random sentence(s) based on different flags |
supportedcollection | list all supported data collections |
synonymsentence | generates random sentence(s) with words replaced by their synonyms |
word | generates random word(s) based on different flags |
| Flag | Purpose |
|---|---|
-c, --count int | count of times to generate (default 1) |
kis synthetic float32
Section titled “kis synthetic float32”this command generates float32 number(s) based on the min, max and count flags
kis synthetic float32 [flags]kis synthetic fuzzysentence
Section titled “kis synthetic fuzzysentence”this command generates random fuzzy sentence(s) base on the given template.
kis synthetic fuzzysentence [flags]| Flag | Purpose |
|---|---|
-t, --template string | this defines the template which should be used to generate the sentences with synonyms from (required) |
kis synthetic fuzzyword
Section titled “kis synthetic fuzzyword”this command generates random fuzzy word(s) base on the given template.
kis synthetic fuzzyword [flags]| Flag | Purpose |
|---|---|
-t, --template string | this defines the template which should be used to generate the words with synonyms from (required) |
kis synthetic int
Section titled “kis synthetic int”this command generates integer(s) based on the min, max and count flags
kis synthetic int [flags]kis synthetic sentence
Section titled “kis synthetic sentence”this command generates random sentence(s) depending on different flags like minlen, maxlen, region(future implementation)
kis synthetic sentence [flags]| Flag | Purpose |
|---|---|
-r, --region string | this defines the region from which the sentences should be generated (default “en-us”) |
kis synthetic supportedcollection
Section titled “kis synthetic supportedcollection”this command lists all supported data collections for a given region.
kis synthetic supportedcollection [flags]| Flag | Purpose |
|---|---|
-r, --region string | this specifies the region for which the command should list the collections for (default “en-us”) |
kis synthetic synonymsentence
Section titled “kis synthetic synonymsentence”this command generates random sentence(s) based on the given template.
kis synthetic synonymsentence [flags]| Flag | Purpose |
|---|---|
-r, --region string | this defines the region from which the synonyms should be generated (default “en-us”) |
-s, --synonym strings | this defines the words you want replaced by their synonyms (if they exist) from the given template. If they are not present, the template is returned as is. |
-t, --template string | this defines the template which should be used to generate the sentences with synonyms from (required) |
kis synthetic word
Section titled “kis synthetic word”this command generates random word(s) depending on different flags like minlen, maxlen, region(future implementation)
kis synthetic word [flags]| Flag | Purpose |
|---|---|
-r, --region string | this defines the region from which the words should be generated (default “en-us”) |
-s, --synonym string | this defines the word whose synonym you want generated. when this is present, flags like min, max and count are ignored |
-t, --template string | this defines the collection which should be used to generate the words from (default “word”) |