@usecortex-official/cli
v0.1.0
Published
Open-source CLI for usecortex — markdown sync + session capture
Maintainers
Readme
@usecortex/cli
Open-source CLI for usecortex — sync markdown folders and capture session memories to your encrypted knowledge base.
Install
npm install -g @usecortex/cliOr run directly:
npx @usecortex/cliSetup
- Get an API key from usecortex.net → Settings → API Keys
- Run:
cortex initOr set the environment variable:
export CORTEX_API_KEY=ctx_sk_your_key_hereCommands
Knowledge
# Sync a markdown folder to usecortex
cortex sync ./docs
# Sync with preview (dry run)
cortex sync ./docs --dry-run
# Force re-sync all files
cortex sync ./docs --force
# Push a single markdown file
cortex push ./notes/architecture.md
cortex push ./notes/architecture.md --topic "arch"
# Export all knowledge as markdown
cortex pull ./export
cortex pull --format json -o backup.json
# Search your knowledge base
cortex search "authentication flow"
# Ask AI-powered questions
cortex ask "How does the billing system work?"
# Get project context (CLAUDE.md format)
cortex context my-project
cortex context my-project -o CLAUDE.mdSession Memory (Memory/Team plans)
# Capture a session
cortex capture "Refactored auth module to use JWT" \
--tool claude-code \
--project my-app \
--tags "auth,refactor"
# Search session memories
cortex recall "authentication changes"
cortex recall "database migrations" --project my-app
# List recent sessions
cortex sessions
cortex sessions --tool claude-code --limit 5Configuration
# Check connection status
cortex whoami
# Reconfigure
cortex init --key ctx_sk_your_new_keyHow Sync Works
- Scans the folder for
.mdfiles - Splits each file into facts by headings
- Derives topic names from folder structure or filenames
- Tracks file hashes in
.cortex-sync.jsonto skip unchanged files - Only sends changed files on subsequent runs
Environment Variables
| Variable | Description |
|---|---|
| CORTEX_API_KEY | API key (overrides config file) |
| CORTEX_API_URL | Custom API URL (default: https://api.usecortex.net) |
Config
Stored at ~/.cortex/config.json (permissions: 600).
Links
- UseCortex — Create your account and manage knowledge
- cortex-mcp — MCP server for AI coding agents
License
MIT
