CLI tool for Exocortex knowledge management system - SPARQL queries, task management, and more
npm install @kitelev/exocortex-cliCommand-line interface for Exocortex knowledge management system. Manage tasks, projects, and planning from the terminal without needing Obsidian.
Current Version: 0.1.x (Stable API)
This CLI follows Semantic Versioning. The commands documented below are considered stable and covered by versioning guarantees.
Documentation:
- CLI API Reference - Formal command signatures and options
- Versioning Policy - What constitutes breaking changes
- SPARQL Guide - Complete query reference
- SPARQL Cookbook - Real-world query examples
- Ontology Reference - Available predicates
For MCP Integration:
- Pin to ^0.1.0 for stable API access
- Use exit codes for status (not console messages)
- Use --format json for machine-readable output
``bash`
npm install -g @exocortex/cli
Or use directly with npx:
`bash`
npx @exocortex/cli [command]
`bash`
exocortex --help
Execute SPARQL queries against your Obsidian vault as an RDF knowledge graph.
`bash`
exocortex sparql query "SELECT ?s ?p ?o WHERE { ?s ?p ?o } LIMIT 10" --vault ~/vault
Options:
- - SPARQL query string or path to .sparql file [required]--vault
- - Path to Obsidian vault (default: current directory)--format
- - Output format: table (default), json, csv--explain
- - Show optimized query plan (for debugging)--stats
- - Show execution statistics (load time, query time, results count)--no-optimize
- - Disable query optimization
Examples:
`bashFind all tasks
exocortex sparql query \
"PREFIX exo:
PREFIX ems:
SELECT ?task ?label
WHERE {
?task exo:Instance_class ems:Task .
?task exo:Asset_label ?label .
}" \
--vault ~/vault
Sample Output (Table Format):
`
š¦ Loading vault: /Users/you/vault...
ā
Loaded 1,234 triples in 45msš Parsing SPARQL query...
š Translating to algebra...
šÆ Executing query...
ā
Found 5 result(s) in 12ms
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
ā ?label ā ?effort ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¼āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā¤
ā "Implement SPARQL Engine" ā "240" ā
ā "Write Documentation" ā "120" ā
ā "Design Architecture" ā "180" ā
āāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāāā
`$3
Execute plugin commands on single assets. All commands follow the pattern:
`bash
exocortex command [options]
`Common Options:
-
--vault - Path to Obsidian vault (default: current directory)
- --dry-run - Preview changes without modifying filesSee CLI API Reference for complete command documentation.
#### Status Commands
`bash
Start a task (ToDo ā Doing)
exocortex command start "tasks/my-task.md" --vault ~/vaultComplete a task (Doing ā Done)
exocortex command complete "tasks/my-task.md" --vault ~/vaultMove to backlog
exocortex command move-to-backlog "tasks/defer-task.md" --vault ~/vaultMove to ToDo
exocortex command move-to-todo "tasks/ready-task.md" --vault ~/vaultTrash a task
exocortex command trash "tasks/obsolete-task.md" --vault ~/vaultArchive a task
exocortex command archive "tasks/old-task.md" --vault ~/vault
`#### Creation Commands
`bash
Create a new task
exocortex command create-task "tasks/new-task.md" \
--label "Implement feature X" \
--area "areas/product" \
--vault ~/vaultCreate a new meeting
exocortex command create-meeting "meetings/standup.md" \
--label "Daily Standup $(date +%Y-%m-%d)" \
--prototype "prototypes/standup-template" \
--vault ~/vaultCreate a new project
exocortex command create-project "projects/website-redesign.md" \
--label "Website Redesign Q1 2026" \
--vault ~/vaultCreate a new area
exocortex command create-area "areas/product.md" \
--label "Product Development" \
--vault ~/vault
`#### Property Commands
`bash
Rename file to match its UID
exocortex command rename-to-uid "tasks/My Task Name.md" --vault ~/vaultUpdate asset label
exocortex command update-label "tasks/task.md" --label "New Label" --vault ~/vaultSchedule task for a date
exocortex command schedule "tasks/feature.md" --date "2025-12-15" --vault ~/vaultSet deadline
exocortex command set-deadline "tasks/feature.md" --date "2025-12-31" --vault ~/vault
`Workflow Examples
$3
`bash
Schedule tasks for today
exocortex command schedule "tasks/task1.md" --date "$(date +%Y-%m-%d)" --vault ~/vault
exocortex command schedule "tasks/task2.md" --date "$(date +%Y-%m-%d)" --vault ~/vaultMove them to ToDo
exocortex command move-to-todo "tasks/task1.md" --vault ~/vault
exocortex command move-to-todo "tasks/task2.md" --vault ~/vault
`$3
`bash
Create multiple tasks for a project
exocortex command create-task "tasks/update-homepage.md" \
--label "Update homepage" \
--parent "projects/website-redesign" \
--vault ~/vaultexocortex command create-task "tasks/redesign-nav.md" \
--label "Redesign navigation" \
--parent "projects/website-redesign" \
--vault ~/vault
exocortex command create-task "tasks/test-mobile.md" \
--label "Test on mobile" \
--parent "projects/website-redesign" \
--vault ~/vault
`$3
`bash
Create this week's review meeting
exocortex command create-meeting "meetings/weekly-review-$(date +%Y-%m-%d).md" \
--label "Weekly Review $(date +%Y-%m-%d)" \
--prototype "prototypes/weekly-review-template" \
--vault ~/vault
`$3
`bash
1. Create task
exocortex command create-task "tasks/feature.md" --label "Implement feature" --vault ~/vault2. Move to ToDo when ready
exocortex command move-to-todo "tasks/feature.md" --vault ~/vault3. Start working
exocortex command start "tasks/feature.md" --vault ~/vault4. Complete when done
exocortex command complete "tasks/feature.md" --vault ~/vault5. Archive for cleanup
exocortex command archive "tasks/feature.md" --vault ~/vault
`$3
Execute multiple operations in a single CLI invocation for better performance:
`bash
Execute batch from JSON input
exocortex batch --input '[
{"command":"start","filepath":"tasks/task1.md"},
{"command":"complete","filepath":"tasks/task2.md"},
{"command":"trash","filepath":"tasks/task3.md"}
]' --vault ~/vaultExecute batch from file
exocortex batch --file operations.json --vault ~/vaultAtomic mode (all-or-nothing - rollback on any failure)
exocortex batch --file operations.json --vault ~/vault --atomicDry run (preview without modifying files)
exocortex batch --input '[{"command":"start","filepath":"task.md"}]' --vault ~/vault --dry-runJSON output for MCP integration
exocortex batch --file operations.json --vault ~/vault --format json
`Batch Options:
-
--input - JSON array of operations to execute
- --file - Path to JSON file containing operations
- --atomic - All-or-nothing execution (rollback on any failure)
- --dry-run - Preview changes without modifying files
- --format - Output format: text (default), json
- --vault - Path to Obsidian vault (default: current directory)Operation Format:
`json
{
"command": "start", // Command name (required)
"filepath": "tasks/task.md", // File path (required)
"options": { // Optional command parameters
"label": "New Label",
"date": "2025-12-15"
}
}
`Supported Commands:
-
start - Start task (ToDo ā Doing)
- complete - Complete task (Doing ā Done)
- trash - Trash task
- archive - Archive task
- move-to-backlog - Move to Backlog
- move-to-analysis - Move to Analysis
- move-to-todo - Move to ToDo
- update-label - Update label (requires options.label)
- schedule - Schedule task (requires options.date)
- set-deadline - Set deadline (requires options.date)Performance Benefits:
- Single process execution (no repeated Node.js startup overhead)
- Vault loaded once for all operations
- Batch of 10 operations is ~10x faster than 10 separate CLI calls
MCP Integration Example:
`json
{
"success": true,
"data": {
"success": true,
"total": 3,
"succeeded": 3,
"failed": 0,
"results": [
{"success": true, "command": "start", "filepath": "task1.md", "action": "Started task"},
{"success": true, "command": "complete", "filepath": "task2.md", "action": "Completed task"},
{"success": true, "command": "trash", "filepath": "task3.md", "action": "Trashed task"}
],
"durationMs": 45,
"atomic": false
},
"meta": {
"durationMs": 45,
"itemCount": 3
}
}
`Architecture
The CLI uses
exocortex for business logic and implements a Node.js file system adapter:`
exocortex-cli/
āāā src/
ā āāā index.ts - Main CLI entry point
ā āāā adapters/
ā ā āāā NodeFsAdapter.ts - Node.js file system implementation
ā āāā commands/
ā āāā create-task.ts
ā āāā create-instance.ts
ā āāā status.ts
ā āāā plan.ts
āāā dist/ - Compiled output
`Features
- SPARQL Query Engine - Execute SPARQL 1.1 queries against vault as RDF knowledge graph
- BGP (Basic Graph Pattern) execution with variable bindings
- Query optimization (filter push-down, join reordering)
- Multiple output formats (table, JSON, CSV)
- Query plan visualization (--explain flag)
- Performance statistics (--stats flag)
- File System Operations - Read/write markdown files with frontmatter
- Task Creation - Generate tasks from areas, projects, and prototypes
- Instance Creation - Create instances from prototypes
- Status Management - Update task status through workflow
- Planning - Assign tasks to specific days
- Frontmatter Support - Full YAML frontmatter parsing and manipulation
- Progress Indicators - Spinners and colored output for better UX
Development
`bash
Install dependencies
npm installBuild
npm run buildRun locally
node dist/index.js --helpWatch mode
npm run dev
`Requirements
- Node.js >= 18.0.0
- A vault with Exocortex-compatible markdown files
Vault Structure
Your vault should follow Exocortex conventions:
`
vault/
āāā areas/
ā āāā work.md
ā āāā personal.md
āāā projects/
ā āāā website-redesign.md
āāā tasks/
ā āāā abc-123.md
ā āāā def-456.md
āāā prototypes/
āāā weekly-review.md
āāā standup.md
`Each file should have YAML frontmatter with Exocortex properties:
`yaml
---
exo__Asset_isDefinedBy: my-ontology
exo__Asset_uid: abc-123
exo__Instance_class:
- "[[ems__Task]]"
ems__Effort_status: "[[ems__EffortStatusDraft]]"
---
`Roadmap
$3
SPARQL Query:
-
exocortex sparql query - Execute SPARQL queries against vaultStatus Transitions:
-
exocortex command start - Start effort (ToDo ā Doing)
- exocortex command complete - Complete effort (Doing ā Done)
- exocortex command trash - Trash effort
- exocortex command archive - Archive effort
- exocortex command move-to-backlog - Move to Backlog
- exocortex command move-to-analysis - Move to Analysis
- exocortex command move-to-todo - Move to ToDoAsset Creation:
-
exocortex command create-task - Create new task
- exocortex command create-meeting - Create new meeting
- exocortex command create-project - Create new project
- exocortex command create-area - Create new areaProperty Mutations:
-
exocortex command rename-to-uid - Rename file to match UID
- exocortex command update-label - Update asset label
- exocortex command schedule - Set planned start date
- exocortex command set-deadline - Set planned end dateBatch Operations:
-
exocortex batch - Execute multiple operations in single invocation$3
-
exocortex command rollback-status - Rollback to previous status
- exocortex command shift-schedule - Shift planned date forward/backward
- exocortex list tasks - List all tasks (with filters)
- exocortex list today - List today's scheduled tasks
- exocortex report weekly` - Generate weekly effort reportMIT