Files
2026-01-07 19:21:19 -05:00

1.8 KiB

API Reference

Complete API documentation for the cortex Python modules.

Core Modules

Module Description
prompts Prompt library management (discover, activate, deactivate)
installer Post-install helpers (completions, manpages, docs)

TUI Modules

Module Description
shell_integration Shell alias installation for bash/zsh/fish
tui_workflow_viz Workflow visualization (timeline, Gantt, dependency trees)

Core Subsystem

Module Description
core/migration Config migration from v1 to v2 format
core/scenarios Multi-phase scenario orchestration

Intelligence Modules

Module Description
intelligence/context_health Context alignment analysis and health scoring

Common Patterns

Return Convention

Most functions return Tuple[int, str]:

  • int: Exit code (0 = success, non-zero = error)
  • str: Human-readable message
code, msg = some_function()
if code == 0:
    print(f"Success: {msg}")
else:
    print(f"Error: {msg}")

Home Directory Override

Functions accept home: Path | None for testing:

# Use default (~)
result = discover_prompts()

# Override for testing
result = discover_prompts(home=Path("/tmp/test-home"))

Dry Run Support

Installer functions support dry_run=True:

# Preview without making changes
code, msg = install_completions(dry_run=True)
print(msg)  # "Would install bash completions to: ~/.bash_completion.d/..."