Skip to main content
CogOS is designed to be adapted. Here are all the extension points available:
Extension PointHow
Custom schema structureDefine your own paths in UniversalSchemaDomain
Custom schema templatesCreate .json files in ./templates/ directory
Custom CM behaviorWrite your own system_prompt_builder(state, registry) -> str
Custom chatbot promptPass any template with {recalled_data} placeholder
Custom toolsExtend SCProtocol.tools() with domain-specific operations
Custom persistenceReplace StateManager / SchemaFileManager with your own backend
Any LLM providerSet base_url to any OpenAI-compatible endpoint
Custom input formatsSubclass InputConverter and implement convert()
PluginsRegister via .use(plugin) — add hooks & prompt vars without editing core

Custom Schema Structure

from cogos import UniversalSchemaDomain

medical = UniversalSchemaDomain("medical_record")
medical.create_field("patient.name", "", "Patient full name")
medical.create_field("diagnosis.current", "", "Current diagnosis")
medical.create_field("medication.current", "", "Current medications")
medical.create_field("medication.allergies", "", "Drug allergies")

cogos = CogOS(config).register(medical)

Custom CM Prompt

Override the CM agent’s behavior by providing a custom system_prompt_builder:
def my_cm_prompt(state, registry):
    schema_overview = registry.inspect_all(max_depth=3)
    return f"""You are a medical records agent.

Available schemas:
{schema_overview}

Extract: diagnoses, medications, allergies, vitals.
When done: {{"continue": false}}"""

cogos = CogOS(config).cm_prompt(my_cm_prompt).chatbot_prompt(my_template)

Custom Chatbot Prompt

The chatbot prompt template receives {recalled_data} (recalled schema content) and any custom variables injected by plugins:
my_template = """You are a helpful medical assistant.

Patient records:
{recalled_data}

{rag_section}

Respond based on the patient's records above."""

Custom Input Formats

Subclass InputConverter for custom data formats:
from cogos.converters import InputConverter

class MyConverter(InputConverter):
    def can_handle(self, data) -> bool:
        return isinstance(data, MyCustomType)

    def convert(self, data) -> str:
        return str(data)