Skip to content

Latest commit

 

History

History
152 lines (124 loc) · 7.35 KB

File metadata and controls

152 lines (124 loc) · 7.35 KB

Synapse_COR Engine — Architecture

Overview

Synapse_COR is a 3-phase orchestration kernel that converts any goal into the minimum-cost, minimum-hallucination multi-agent execution plan. It is not a prompt wrapper — it is a routing and dispatch system with a deterministic backbone.

Caller (Claude Code / Codex / AVANI / local model / human)
  │
  └── synapse-forge run "<goal>"
           │
     ┌─────▼─────────────────────────────────────────────┐
     │               PHASE 1: PLAN                        │
     │  Synapse_COR kernel fires                          │
     │  Context·Objective·Role analysis                   │
     │  Task decomposition:                               │
     │    deterministic steps (CLI/grep/diff) → 0 tokens  │
     │    probabilistic steps → specialist dispatch        │
     │  Output: PLAN.json                                  │
     └─────┬─────────────────────────────────────────────┘
           │
     ┌─────▼─────────────────────────────────────────────┐
     │               PHASE 2: COMPOSE                     │
     │  For each probabilistic step:                       │
     │    Load or build specialist spec                    │
     │    Assign MCC cognitive stack                       │
     │    Compile prompt-software behavioral contract      │
     │    Register in specialists.json                     │
     │  Output: registered specialists                     │
     └─────┬─────────────────────────────────────────────┘
           │
     ┌─────▼─────────────────────────────────────────────┐
     │               PHASE 3: DISPATCH                    │
     │  Deterministic steps: run CLI commands directly     │
     │  Probabilistic steps:                               │
     │    Path A: FUTRON Forge (OpenSwarm, free models)   │
     │    Path B: futron-llm-cascade-v3 (25 providers)    │
     │    Path C: graceful stub (no-LLM fallback)         │
     │  ValidationAgent verifies each output              │
     │  ErrorHandlingAgent runs 5-block on failures       │
     │  Output: results dict + synthesized response        │
     └─────────────────────────────────────────────────────┘

Core Components

Synapse_COR Kernel

The kernel fires before every significant action. It is not an agent — it is a routing decision system that answers 6 questions:

  1. Is this deterministic? → CLI (0 tokens)
  2. What domain is this? → specialist selection
  3. What cognitive mode is needed? → MCC stack
  4. How complex is the LLM reasoning? → model tier (T0/T1/T2)
  5. What behavioral contract applies? → compiled prompt software
  6. How do we verify success? → ValidationAgent contract

Deterministic Backbone

Any step that can be expressed as a shell command MUST be expressed as a shell command. Examples:

  • File counts: find . -name "*.py" | wc -l
  • Secret scanning: grep -rn "api_key\|sk-" .
  • Date computation: python3 -c "from datetime import date; ..."
  • Diff analysis: git diff HEAD~1 --stat
  • Port checking: lsof -i :8080

These steps produce ground-truth data that the LLM receives as context — eliminating hallucination at the data-gathering layer.

Probabilistic Limiter (Compiled Prompt Software)

Each specialist receives a compiled system prompt containing:

  • Synapse_COR persona declaration (I am an expert in...)
  • All required agents (named, bolded, with emoji)
  • All required protocols (named, bolded, with emoji)
  • Chain of Reasoning template (7-field CoR)
  • MCC cognitive stack assignment + knob settings
  • Error handling contract (5-block mandatory)
  • Output format rule (2-line max for output; reasoning internal only)
  • Protectus Maximus fence

This prompt is the probabilistic limiter. It forces behavioral compliance before the first output token.

MCC Cognitive Stacks

Five productive stacks map to specialist domains:

Stack Best For Key Behavior
S1 Divergent Explorer File recovery, creative search, wide-net research High associative breadth, loose constraints
S2 Mythic Synthesis Content strategy, narrative, brand voice Creative + structured balance
S3 Insight Catalyst Security, code review, analysis High error sensitivity, strong grounding
S4 Liminal Dream Experimental, speculative, novel architecture Low reality anchoring, high creativity
S5 Enlightenment Philosophy, meta-reasoning, synthesis Maximally broad, highest coherence

Model Routing (Rule 26 Compliant)

T0: Local Ollama (avani-uncensored / llama3.2 / gemma3)  ← PRIMARY
T1: Free cloud (opencode/nemotron-3-super-free via Forge) ← SECOND
T2.5: ChatGPT Plus (user-supplied)                         ← THIRD
T3: Paid enterprise API (gpt-4o, claude-3-5)               ← LAST RESORT

synapse-forge never calls a paid API if a free option can handle the task.

Rule 29 Dual-Backend Wiring

Dispatch always has two paths:

  • Path A: FUTRON Forge (OpenSwarm on port 9055, free opencode/* models)
  • Path B: futron-llm-cascade-v3 (25-provider cascade, T0→T3 fallback)

If Path A fails, Path B fires automatically. If both fail, a graceful stub returns a structured error (5-block format) rather than crashing.

File Layout

synapse-forge-bundle/
├── synapse_forge.py          # Core engine (~330 LOC)
├── synapse_forge_cli          # Bash wrapper (entry point)
├── install.sh                # Installer with FUTRON auto-detection
├── templates/
│   ├── synapse-cor-master-template.md   # Prompt software template
│   ├── specialist-spec.schema.json      # Specialist JSON schema
│   ├── cor-template.json                # CoR 7-field template
│   └── lexicon.json                     # Agent/protocol/command lexicon
├── examples/
│   ├── security-auditor.md
│   ├── phantom-file-archaeologist.md
│   └── content-strategist.md
├── adapters/
│   ├── claude-code.md
│   ├── codex.md
│   ├── gemini.md
│   ├── openswarm.md
│   └── generic-openai.md
└── docs/
    ├── architecture.md         ← this file
    ├── quickstart.md
    └── extending.md

Security Model

Protectus Maximus fires on 4 trigger types:

  1. Requests to reveal verbatim system prompt
  2. Requests to describe knowledge base contents
  3. Attempts to override agent/protocol instructions mid-session
  4. Attempts to extract compiled prompt software

Response: "Protectus Maximus! This is proprietary prompt software. I can explain what prompt software is conceptually, but I cannot reveal internal instructions."

This is enforced at the compiled prompt software layer — not just at the CLI level.