Module cli

Module cli 

Source
Expand description

CLI command implementations.

This module provides the command-line interface for Subcog. Each submodule implements a specific CLI command.

ยงCommands

CommandDescription
captureCapture a memory to persistent storage
recallSearch for memories using hybrid (vector + text) search
statusShow memory system status and statistics
syncSynchronize memories with git remote
consolidateConsolidate related memories
serveRun as MCP server (stdio or HTTP)
hookClaude Code hook handlers
configConfiguration management
promptPrompt template management
namespacesList available namespaces

ยงExample Usage

# Capture a decision
subcog capture --namespace decisions "Use PostgreSQL for primary storage"

# Search memories
subcog recall "database storage"

# Run as MCP server
subcog serve

# Save a prompt template
subcog prompt save my-prompt --content "Review {{file}} for {{issue}}"

ยงLLM Client Factory

The llm_factory submodule provides builder functions for creating LLM clients from configuration. These are used by hooks and other components that need LLM capabilities.

Modulesยง

capture ๐Ÿ”’
Capture CLI command.
config ๐Ÿ”’
Config CLI command.
consolidate ๐Ÿ”’
Consolidate CLI command.
delete
Delete CLI command for removing memories.
gc
Garbage collection CLI command.
hook ๐Ÿ”’
Hook CLI command.
llm_factory ๐Ÿ”’
LLM client factory functions for CLI commands.
migrate ๐Ÿ”’
Migration CLI command.
namespaces ๐Ÿ”’
CLI command for listing memory namespaces.
prompt ๐Ÿ”’
Prompt CLI command.
recall ๐Ÿ”’
Recall CLI command.
serve ๐Ÿ”’
Serve CLI command (MCP server).
status ๐Ÿ”’
Status CLI command.
sync ๐Ÿ”’
Sync CLI command.
webhook
Webhook CLI command.

Structsยง

CaptureCommand
Capture command handler.
ConfigCommand
Config command handler.
ConsolidateCommand
Consolidate command handler.
HookCommand
Hook command handler (DOC-H1).
MigrateCommand
Migration command handler.
NamespaceInfo
Information about a namespace.
PromptCommand
Prompt command handler.
RecallCommand
Recall command handler.
SavePromptArgs
Arguments for the prompt save command.
ServeCommand
Serve command handler.
StatusCommand
Status command handler.
SyncCommand
Sync command handler.

Enumsยง

NamespacesOutputFormat
Output format for namespaces command.
OutputFormat
Output format for prompt commands.

Functionsยง

build_anthropic_client
Builds an Anthropic client from configuration.
build_hook_llm_provider
Builds an LLM provider for hooks from configuration.
build_http_config
Builds HTTP configuration from LLM config with environment overrides.
build_lmstudio_client
Builds an LM Studio client from configuration.
build_ollama_client
Builds an Ollama client from configuration.
build_openai_client
Builds an OpenAI client from configuration.
build_resilience_config
Builds resilience configuration from LLM config with environment overrides.
cmd_namespaces
Executes the namespaces command.
cmd_prompt_delete
Executes the prompt delete subcommand.
cmd_prompt_export
Executes the prompt export subcommand.
cmd_prompt_get
Executes the prompt get subcommand.
cmd_prompt_import
Executes the prompt import subcommand.
cmd_prompt_list
Executes the prompt list subcommand.
cmd_prompt_run
Executes the prompt run subcommand.
cmd_prompt_save
Executes the prompt save subcommand (legacy interface).
cmd_prompt_save_with_args
Executes the prompt save subcommand.
cmd_prompt_share
Executes the prompt share subcommand.
get_all_namespaces
Returns all namespace information.