Skip to content

seclai/seclai-cli

Repository files navigation

Seclai CLI

Full-featured command-line interface for the Seclai platform. Manage agents, knowledge bases, sources, memory banks, evaluations, solutions, governance, and more — all from the terminal.

All commands return JSON to stdout, so you can pipe into jq or other tools.

Install

npm i -g @seclai/cli

Or run directly via npx (no install needed):

npx @seclai/cli agents list

Setup Skills and MCP

If you are using an AI coding agent like Claude Code, you can also install the skill individually with:

seclai skills install

This installs skills into all detected coding editors by default. Use --tool <tool> to scope it to one editor.

To install the Seclai MCP server into your editors (Cursor, Claude Code, VS Code, etc.):

seclai mcp configure --key "$SECLAI_API_KEY"

Or directly via npx:

npx skills add seclai/seclai-cli --full-depth --global --all
npx add-mcp https://api.seclai.com/mcp --header "X-API-Key: $SECLAI_API_KEY" --name Seclai

Documentation

Command reference (latest): https://seclai.github.io/seclai-cli/latest/

Authentication

The CLI supports two authentication methods:

API Key

Set the SECLAI_API_KEY environment variable, or pass --api-key per-command:

export SECLAI_API_KEY="sk-..."

# or inline
seclai --api-key "$SECLAI_API_KEY" agents list

SSO (OAuth2 Bearer Token)

SSO works out of the box with built-in production defaults — no configuration needed:

# Authenticate via browser (Authorization Code + PKCE)
seclai auth login

# Check authentication status
seclai auth status

# Refresh tokens manually
seclai auth refresh

# Log out (clears cached tokens)
seclai auth logout

For custom SSO settings (e.g. staging environment), use seclai configure sso or set environment variables:

Variable Description Default
SECLAI_SSO_DOMAIN Cognito domain auth.seclai.com
SECLAI_SSO_CLIENT_ID Cognito app client ID 4bgf8v9qmc5puivbaqon9n5lmr
SECLAI_SSO_REGION AWS region us-west-2

Use a named profile with --profile:

seclai --profile staging agents list

Tokens are cached in ~/.seclai/sso/cache/ and auto-refreshed when expired.

Environment Variables

Variable Description
SECLAI_API_KEY Default API key (alternative to --api-key)
SECLAI_API_URL Override API base URL (default: https://api.seclai.com)
SECLAI_PROFILE Default SSO profile name (default: default)
SECLAI_CONFIG_DIR Config directory path (default: ~/.seclai)
SECLAI_SSO_DOMAIN Override SSO domain (default: auth.seclai.com)
SECLAI_SSO_CLIENT_ID Override SSO client ID (default: 4bgf8v9qmc5puivbaqon9n5lmr)
SECLAI_SSO_REGION Override SSO region (default: us-west-2)

Global Options

Flag Description
--api-key <key> Seclai API key
--profile <name> SSO profile name
--account-id <id> Account ID (X-Account-Id header)
--config-dir <path> Config directory path
--compact Output compact (single-line) JSON
-V, --version Print version

Commands

Agents

seclai agents list [--page N] [--limit N]
seclai agents create --json '{"name":"My Agent"}'
seclai agents get <agentId>
seclai agents update <agentId> --json '{"name":"Renamed"}'
seclai agents delete <agentId>

Running Agents

Four modes: basic, streaming (SSE wait), events (NDJSON), and polling.

# Basic run (returns final result)
seclai agents run <agentId> --json '{"input":"Hello"}'
seclai agents run <agentId> --json-file ./run.json
cat run.json | seclai agents run <agentId> --json-file -

# SSE streaming (waits for done event or timeout)
seclai agents run <agentId> --json '{"input":"Hi"}' --stream --timeout-ms 60000

# NDJSON event stream (outputs every SSE event as a JSON line)
seclai agents run <agentId> --json '{"input":"Hi"}' --events
seclai agents run <agentId> --json '{"input":"Hi"}' --events --event-filter status
seclai agents run <agentId> --json '{"input":"Hi"}' --events --output data

# Polling (submit then poll until complete)
seclai agents run <agentId> --json '{"input":"Hi"}' --poll --poll-interval-ms 2000

Agent Runs

seclai agents runs list <agentId> [--page N] [--limit N]
seclai agents runs get <runId> [--include-step-outputs]
seclai agents runs delete <runId>
seclai agents runs cancel <runId>
seclai agents runs search [--page N] [--limit N] [--json '...']
seclai agents runs eval-results <agentId> <runId> [--page N] [--limit N]
# Download a file attachment emitted by a run step. attachmentId is the
# URL-safe-base64 storage_key from run output manifests / webhooks.
seclai agents runs download-attachment <runId> <attachmentId> [--download-name <name>] [--output <path>]

Agent Definition

seclai agents def get <agentId>
seclai agents def update <agentId> --json '{"steps":[...]}'

Agent Export / Import

seclai agents export <agentId>
seclai agents export <agentId> --no-download

# Validate an agent_definition payload without creating an agent.
# Reports counts and any unresolved_refs you'll need to map with entity_remap
# when calling `agents create` or `agents update`.
# The body shape is `{ "agent_definition": <export payload> }`.
seclai agents preview-import --json-file ./preview-body.json
seclai agents export <agentId> \
  | jq '{agent_definition: .}' \
  | seclai agents preview-import --json-file -

Agent Input Upload

# Discover which files (if any) the agent expects before staging uploads.
seclai agents attachment-references <agentId>
seclai agents upload-input <agentId> --file ./data.csv [--file-name data.csv] [--mime-type text/csv]
seclai agents input-status <agentId> <uploadId>

Agent AI Assistant

seclai agents ai gen-steps <agentId> --user-input "Build a QA chatbot"
seclai agents ai step-config <agentId> --user-input "Configure the search step"
seclai agents ai history <agentId>
seclai agents ai mark <agentId> <conversationId> --json '{"accepted":true}'

Sources

seclai sources list [--page N] [--limit N] [--sort <field>] [--order asc|desc]
seclai sources create --json '{"name":"Docs","type":"manual"}'
seclai sources get <sourceId>
seclai sources update <sourceId> --json '{"name":"Renamed"}'
seclai sources delete <sourceId>

source is an alias for sources (e.g. seclai source list).

Upload

seclai sources upload <sourceId> --file ./doc.pdf [--title "Doc"] [--mime-type application/pdf] [--metadata '{}']
seclai sources upload-text <sourceId> --json '{"title":"Note","text":"Hello world"}'

Exports

seclai sources exports list <sourceId> [--page N] [--limit N]
seclai sources exports create <sourceId>
seclai sources exports get <sourceId> <exportId>
seclai sources exports cancel <sourceId> <exportId>
seclai sources exports delete <sourceId> <exportId>
seclai sources exports download <sourceId> <exportId>
seclai sources exports estimate <sourceId>

Embedding Migration

seclai sources migration get <sourceId>
seclai sources migration start <sourceId>
seclai sources migration cancel <sourceId>

Contents

seclai contents get <contentVersionId> [--start N] [--end N]
seclai contents delete <contentVersionId>
seclai contents embeddings <contentVersionId> [--page N] [--limit N]

Upload / Replace

seclai contents upload <contentVersionId> --file ./updated.pdf [--metadata '{}']
seclai contents replace <contentVersionId> --file ./updated.pdf   # alias
seclai contents replace-text <contentVersionId> --json '{"title":"Note","text":"Updated content"}'

Knowledge Bases

seclai kb list [--page N] [--limit N] [--sort <field>] [--order asc|desc]
seclai kb create --json '{"name":"Support KB"}'
seclai kb get <kbId>
seclai kb update <kbId> --json '{"name":"Renamed"}'
seclai kb delete <kbId>

Memory Banks

seclai memory list [--page N] [--limit N]
seclai memory create --json '{"name":"Chat Memory","type":"conversation"}'
seclai memory get <memoryBankId>
seclai memory update <memoryBankId> --json '{"name":"Renamed"}'
seclai memory delete <memoryBankId>
seclai memory stats <memoryBankId>
seclai memory agents <memoryBankId>
seclai memory compact <memoryBankId>
seclai memory delete-source <memoryBankId>
seclai memory templates
seclai memory test-compaction <memoryBankId> [--json '...']
seclai memory test-compaction-standalone [--json '...']

Memory AI Assistant

seclai memory ai generate --user-input "Configure compaction"
seclai memory ai last
seclai memory ai accept <conversationId> --json '{"accepted":true}'

Evaluations

Criteria

seclai evals criteria list <agentId> [--page N] [--limit N]
seclai evals criteria create <agentId> --json '{"name":"Quality"}'
seclai evals criteria get <criteriaId>
seclai evals criteria update <criteriaId> --json '{"name":"Renamed"}'
seclai evals criteria delete <criteriaId>
seclai evals criteria summary <criteriaId>

Results

seclai evals results list <criteriaId> [--page N] [--limit N]
seclai evals results create <criteriaId> --json '{"run_id":"...","score":0.9}'

Agent-level

seclai evals compatible-runs <criteriaId> [--page N] [--limit N]
seclai evals test-draft <agentId> --json '{"criteria":{...}}'
seclai evals agent-results <agentId> [--page N] [--limit N]
seclai evals agent-runs <agentId> [--page N] [--limit N]
seclai evals non-manual-summary <agentId>

Solutions

seclai solutions list [--page N] [--limit N]
seclai solutions create --json '{"name":"My Solution"}'
seclai solutions get <solutionId>
seclai solutions update <solutionId> --json '{"name":"Renamed"}'
seclai solutions delete <solutionId>

Link / Unlink Resources

seclai solutions link <solutionId> --agents '["id1","id2"]' --kb '["id3"]' --sources '["id4"]'
seclai solutions unlink <solutionId> --agents '["id1"]'

Conversations

seclai solutions convos list <solutionId>
seclai solutions convos add <solutionId> --json '{"user_input":"Add a source"}'
seclai solutions convos mark <solutionId> <conversationId> --json '{"accepted":true}'

Solution AI Assistant

seclai solutions ai generate <solutionId> --user-input "Add a FAQ source"
seclai solutions ai kb <solutionId> --user-input "Create a knowledge base"
seclai solutions ai source <solutionId> --user-input "Create a file source"
seclai solutions ai accept <solutionId> <conversationId>
seclai solutions ai decline <solutionId> <conversationId>

Governance

seclai governance ai generate --user-input "Create a content safety policy"
seclai governance ai list
seclai governance ai accept <conversationId>
seclai governance ai decline <conversationId>

Alerts

seclai alerts list [--page N] [--limit N] [--status open] [--severity high]
seclai alerts get <alertId>
seclai alerts status <alertId> --json '{"status":"resolved"}'
seclai alerts comment <alertId> --json '{"comment":"Investigating"}'
seclai alerts subscribe <alertId>
seclai alerts unsubscribe <alertId>

Alert Configurations

seclai alerts configs list [--page N] [--limit N]
seclai alerts configs create --json '{"name":"Critical Alerts","type":"email"}'
seclai alerts configs get <configId>
seclai alerts configs update <configId> --json '{"name":"Renamed"}'
seclai alerts configs delete <configId>

Organization Alert Preferences

seclai alerts prefs list
seclai alerts prefs update <organizationId> <alertType> --json '{"enabled":true}'

Models

Model Alerts

seclai models alerts list [--page N] [--limit N]
seclai models alerts mark-read <alertId>
seclai models alerts mark-all-read
seclai models alerts unread-count

Recommendations

seclai models recommendations <modelId>

Model Playground Experiments

seclai models experiments list [--days N] [--start-date <date>] [--end-date <date>] [--limit N] [--offset N]
seclai models experiments create --json '{"model_ids":["gpt-4o"],"prompt":"Compare responses"}'
seclai models experiments get <experimentId>
seclai models experiments cancel <experimentId>
seclai models experiments delete <experimentId>   # soft-delete, preserves audit history

Search

seclai search --query "deployment guide" [--limit N] [--entity-type agent|source|kb]

AI Assistant

Top-level AI assistant for multi-domain operations.

seclai ai feedback --json '{"conversation_id":"...","feedback":"helpful"}'
seclai ai kb --user-input "Create a support knowledge base"
seclai ai source --user-input "Create a documentation source"
seclai ai solution --user-input "Build a customer support solution"
seclai ai memory --user-input "Create a conversation memory bank"
seclai ai memory-history
seclai ai accept <conversationId> [--json '...']
seclai ai decline <conversationId>
seclai ai memory-accept <conversationId> [--json '...']

Skills

Install Seclai skill files for AI coding tools (Copilot, Claude Code, Cursor, Windsurf, Codex, Kiro, Cline, Roo Code, Gemini, Antigravity).

# Auto-detect tools from workspace directory structure
seclai skills install

# Target a specific tool
seclai skills install --tool copilot
seclai skills install --tool claude
seclai skills install --tool cursor
seclai skills install --tool kiro
seclai skills install --tool cline

# Install for all supported tools
seclai skills install --tool all

# Specify a custom directory
seclai skills install --tool copilot --dir /path/to/project

# Via npx (no install required)
npx @seclai/cli skills install

Skills follow the Agent Skills specification. Each tool gets a seclai-cli/ directory containing a SKILL.md with YAML frontmatter and a references/ subdirectory for progressive disclosure:

Tool Directory
Copilot .github/copilot/seclai-cli/
Claude Code .claude/skills/seclai-cli/
Cursor .cursor/skills/seclai-cli/
Windsurf .windsurf/skills/seclai-cli/
Codex .codex/skills/seclai-cli/
Kiro .kiro/steering/seclai-cli/
Cline .clinerules/seclai-cli/
Roo Code .roo/rules/seclai-cli/
Gemini .gemini/seclai-cli/
Antigravity .antigravity/seclai-cli/

You can also install skills using the skills CLI:

npx skills add seclai/seclai-cli

MCP Server

Configure the Seclai MCP server for AI coding tools:

# Auto-detect tools and write MCP config
seclai mcp configure --key YOUR_API_KEY

# Target a specific tool
seclai mcp configure --key YOUR_API_KEY --target claude-code
seclai mcp configure --key YOUR_API_KEY --target cursor
seclai mcp configure --key YOUR_API_KEY --target claude-desktop
seclai mcp configure --key YOUR_API_KEY --target windsurf

# Configure all known targets
seclai mcp configure --key YOUR_API_KEY --target all

# Show the MCP config snippet (for manual setup)
seclai mcp show
seclai mcp show --key YOUR_API_KEY
Target Config File Scope
claude-code .mcp.json Project
cursor .cursor/mcp.json Project
claude-desktop ~/Library/Application Support/Claude/claude_desktop_config.json Global
windsurf ~/.codeium/windsurf/mcp_config.json Global

The command merges into existing config files — it won't overwrite other MCP servers.

Shell Completion

Generate shell completion scripts for tab-completion of commands:

# Bash — add to ~/.bashrc
eval "$(seclai completion bash)"

# Zsh — add to ~/.zshrc
eval "$(seclai completion zsh)"

# Fish — save to completions directory
seclai completion fish > ~/.config/fish/completions/seclai.fish

Development

Install dependencies

npm install

Type checking

npm run typecheck

Build

npm run build

Run locally

npm run dev -- --help

Test

npm test

Test global install locally

npm run build
npm link
seclai --help