Skip to main content
Browse docs
By Audience
Getting Started
Configuration
Use Cases
IDE Integration
Third-Party Integrations
Engineering Cache
Console
API Reference
Gateway
Workflow Guides
Templates
Providers and SDKs
Industry Guides
Advanced Guides
Browse by Role
Deployment Guides
In-Depth Guides
Tutorials
FAQ

Manage Knowledge Assets from the Command Line

Knowledge assets are versioned context documents that the gateway injects into LLM requests at runtime — compliance guidelines, product specs, SOPs, or any context that makes AI responses more accurate and compliant. The kt knowledge-base (alias: kt kb) command manages the full asset lifecycle from your terminal.

Use this page when

  • You need to create, version, promote, or bind knowledge assets using the kt knowledge-base (or kt kb) CLI.
  • You are automating knowledge asset updates in a CI/CD pipeline.
  • You want to view citations showing how gateways used your assets at runtime.

Primary audience

  • Primary: Technical Engineers managing knowledge assets and CI pipelines
  • Secondary: Compliance teams promoting reviewed content, AI Agents querying asset status

Knowledge asset lifecycle

Create (draft) → Promote (active) → Bind (to gateway) → Runtime injection
│ │ │ │
│ │ │ └─ Citations recorded
│ │ └─ Gateway uses asset
│ └─ Asset approved for use
└─ Initial upload and versioning

Creating assets

# Create from a file
kt kb create --name "compliance-guidelines" \
--file docs/compliance-v2.md \
--description "SOC 2 compliance guidelines for AI responses"

# Create from stdin
cat product-spec.md | kt kb create --name "product-spec" \
--description "Current product specification"

# Create with metadata tags
kt kb create --name "hipaa-rules" \
--file hipaa-guidelines.md \
--tags "compliance,healthcare,hipaa" \
--description "HIPAA compliance rules for healthcare AI"

Output

Knowledge asset created
───────────────────────
Asset ID: ka-7f2a3b1c
Name: compliance-guidelines
Version: 1
Status: draft
Size: 4.2 KB
Created: 2025-04-23T10:00:00Z
Description: SOC 2 compliance guidelines for AI responses

Versioning assets

Every update creates a new version. Previous versions are preserved for audit trails:

# Update an existing asset (creates a new version)
kt kb update ka-7f2a3b1c --file docs/compliance-v3.md

# List all versions of an asset
kt kb versions ka-7f2a3b1c

# View a specific version
kt kb show ka-7f2a3b1c --version 2

# Compare two versions
kt kb diff ka-7f2a3b1c --from-version 1 --to-version 2
Versions of "compliance-guidelines" (ka-7f2a3b1c)
──────────────────────────────────────────────────
Version Status Created Size
1 archived 2025-01-15T10:00:00Z 4.2 KB
2 active 2025-03-01T14:30:00Z 5.1 KB
3 draft 2025-04-23T10:00:00Z 5.8 KB

Promoting assets

Assets start in draft status. Promote them to active to make them available for gateway binding:

# Promote the latest version to active
kt kb promote ka-7f2a3b1c

# Promote a specific version
kt kb promote ka-7f2a3b1c --version 3

# Promote with a review note
kt kb promote ka-7f2a3b1c --note "Reviewed by compliance team on 2025-04-23"
Asset promoted
──────────────
Asset: compliance-guidelines (ka-7f2a3b1c)
Version: 3 → active
Previous: version 2 → archived

Note: Reviewed by compliance team on 2025-04-23

Binding assets to gateways

Bind active assets to gateways so the enforcement chain injects them into LLM context:

# Bind to a specific gateway
kt kb bind ka-7f2a3b1c --gateway gw-prod-01

# Bind to multiple gateways
kt kb bind ka-7f2a3b1c --gateway gw-prod-01 --gateway gw-prod-02

# List bindings for an asset
kt kb bindings ka-7f2a3b1c

# Unbind from a gateway
kt kb unbind ka-7f2a3b1c --gateway gw-prod-01

Binding in policy config

You can also declare knowledge bindings in your policy configuration:

# policy-config.yaml
version: "1"
knowledge:
- asset: compliance-guidelines
injection: system_prompt
priority: 1
- asset: product-spec
injection: context
priority: 2
policies:
- name: prompt-injection-guard
type: prompt_injection
phase: input
action: block
threshold: 0.85

Listing and searching assets

# List all assets
kt kb list

# Filter by status
kt kb list --status active

# Search by name or tags
kt kb list --search "compliance"
kt kb list --tags "healthcare"

# Show full detail for an asset
kt kb show ka-7f2a3b1c
Knowledge Assets
────────────────
ID Name Status Version Bindings Tags
ka-7f2a3b1c compliance-guidelines active 3 2 compliance,soc2
ka-8e4b2d3f product-spec active 1 1 product
ka-9c5a1e4g hipaa-rules draft 1 0 compliance,healthcare

Bulk operations

Manage assets at scale with bulk commands:

# Bulk create from a directory
kt kb bulk-create --dir knowledge-assets/ \
--tags "bulk-import,2025-q2"

# Bulk promote all draft assets with a specific tag
kt kb list --status draft --tags "reviewed" --format ids | \
xargs -I{} kt kb promote {}

# Export all active assets to a directory
kt kb export --status active --output-dir exported-assets/

CI integration

Automate knowledge asset updates in your deployment pipeline:

# .github/workflows/knowledge-sync.yml
name: Sync Knowledge Assets
on:
push:
branches: [main]
paths: ['knowledge/**']

jobs:
sync:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install kt
run: curl -fsSL https://get.keeptrusts.com | sh

- name: Update changed assets
env:
KT_API_KEY: ${{ secrets.KT_API_KEY }}
run: |
for file in knowledge/*.md; do
name=$(basename "$file" .md)
echo "Updating asset: $name"
kt kb update --name "$name" --file "$file" 2>/dev/null || \
kt kb create --name "$name" --file "$file" --tags "auto-sync"
done

- name: Promote reviewed assets
run: |
kt kb list --status draft --tags "auto-sync" --format ids | \
xargs -I{} kt kb promote {} --note "Auto-promoted from main branch"

Viewing citations

When the gateway uses a knowledge asset, it records a citation. View these from the CLI:

# View citations for an asset
kt kb citations ka-7f2a3b1c --since 7d

# View citations across all assets
kt kb citations --since 24h --format json
Citations for "compliance-guidelines" (last 7 days)
───────────────────────────────────────────────────
Date Gateway User Event
2025-04-22T14:30:00Z gw-prod-01 alice evt-1234
2025-04-22T15:12:00Z gw-prod-01 bob evt-5678
2025-04-23T09:45:00Z gw-prod-02 carol evt-9012

Total citations: 3

Business outcomes

OutcomeHow knowledge management helps
Consistent AI responsesInjected knowledge ensures every response follows current guidelines
Audit trailVersion history and promotion records document who approved what and when
Fast updatesCLI and CI integration lets you update knowledge assets in minutes
Regulatory complianceBind compliance documents to gateways to ensure AI responses align with regulations
Reduced hallucinationProviding authoritative context reduces LLM fabrication of facts

For AI systems

  • Canonical terms: kt knowledge-base (alias kt kb), knowledge asset, draft/active/archived status, promote, bind, citation, version.
  • Commands: kt kb create, kt kb update, kt kb promote, kt kb bind, kt kb unbind, kt kb list, kt kb show, kt kb versions, kt kb diff, kt kb citations, kt kb bulk-create, kt kb export.
  • Config integration: knowledge: section in policy-config.yaml with asset, injection, priority fields.
  • Lifecycle: Create (draft) → Promote (active) → Bind (to gateway) → Runtime injection → Citations recorded.
  • Best next pages: Policy Chains, Declarative Config Patterns.

For engineers

  • Prerequisites: kt CLI authenticated, knowledge asset source files (Markdown, text).
  • Create and promote: kt kb create --name <name> --file <path> then kt kb promote <id>.
  • Bind to gateway: kt kb bind <id> --gateway <gw-id> or declare in policy-config.yaml under knowledge:.
  • CI automation: on push to main, update or create assets then auto-promote reviewed content.
  • Verify: kt kb citations <id> --since 24h confirms the gateway is injecting the asset at runtime.

For leaders

  • Knowledge assets ensure AI responses follow current corporate guidelines, compliance rules, and product specs.
  • Version history and promotion records provide an audit trail of who approved what content and when.
  • Citation tracking proves to auditors that governed context was actually used during LLM interactions.
  • Reduces hallucination risk by grounding model responses in authoritative, versioned documents.

Next steps