SynapsesOS
Reference

Mode & Rules

Mode

The mode field determines how Synapses operates:

ModeDescription
"full"Full code graph + memory. Parses AST, builds graph, serves context. Default.
"knowledge"Memory-only. No code parsing or graph. For non-code domains (design docs, research).
{
"mode": "full"
}

In knowledge mode, code-graph tools like get_context and search(mode="exact") are unavailable. Memory tools (memory(action="save"), memory(action="search")), task management, and knowledge tools work normally.

Rules

Architectural rules enforce constraints on your codebase. They’re checked in real-time and violations surface in validate(phase="list") and get_context.

{
"rules": [
{
"id": "no-handler-db",
"description": "Handlers must not call database directly",
"severity": "error",
"edge_type": "CALLS",
"from_file_pattern": "*/handlers/*",
"to_file_pattern": "*/db/*"
}
]
}

Rule Fields

FieldTypeRequiredDescription
idstringYesUnique identifier
descriptionstringYesHuman-readable explanation
severitystringYes"error" or "warning"
edge_typestringNoEdge type to check (CALLS, IMPORTS, etc.)
from_file_patternstringNoGlob pattern for source file
to_file_patternstringNoGlob pattern for target file
to_name_patternstringNoSubstring match on target entity name
path_patternstringNoMulti-hop path: "CALLS,CALLS,IMPORTS" (up to 8 hops)

Rules can also be created dynamically via the rules(action="upsert") MCP tool.

Path Patterns

Path patterns check multi-hop sequences through the graph:

{
"id": "no-handler-db-indirect",
"description": "No handler-to-database path without service layer",
"severity": "warning",
"path_pattern": "CALLS,CALLS",
"from_file_pattern": "*/handlers/*",
"to_file_pattern": "*/db/*"
}

This catches handler → X → database patterns up to 2 hops deep.