Mode & Rules
Mode
The mode field determines how Synapses operates:
| Mode | Description |
|---|---|
"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
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Unique identifier |
description | string | Yes | Human-readable explanation |
severity | string | Yes | "error" or "warning" |
edge_type | string | No | Edge type to check (CALLS, IMPORTS, etc.) |
from_file_pattern | string | No | Glob pattern for source file |
to_file_pattern | string | No | Glob pattern for target file |
to_name_pattern | string | No | Substring match on target entity name |
path_pattern | string | No | Multi-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.