AgentSkillsCN

synapse

当用户希望深入了解 SYNAPSE 上下文引擎、管理领域、配置上下文规则,或排查规则注入相关问题时,应使用此技能。在被问及 SYNAPSE 架构、领域管理、星号命令、上下文括号,或 8 层处理流水线等话题时,亦可参考此技能。

SKILL.md
--- frontmatter
name: synapse
description: "This skill should be used when users want to understand the SYNAPSE context engine, manage domains, configure context rules, or troubleshoot rule injection. Use when asked about SYNAPSE architecture, domain management, star-commands, context brackets, or the 8-layer processing pipeline."

SYNAPSE Context Engine

Overview

SYNAPSE (Synkra Adaptive Processing & State Engine) is the unified context engine for AIOS. It injects contextual rules into every prompt via an 8-layer processing pipeline, adapting to context window usage through bracket-aware filtering.

What it does:

  • Injects rules per-prompt via Claude Code's UserPromptSubmit hook
  • Processes 8 layers (L0 Constitution through L7 Star-Commands) sequentially
  • Adapts injection volume based on context brackets (FRESH/MODERATE/DEPLETED/CRITICAL)
  • Integrates with agent state (active agent, workflow, task, squad)
  • Outputs <synapse-rules> XML block appended to each prompt

What it replaces: SYNAPSE replaces the legacy CARL system with full feature parity plus 8 new capabilities including agent-scoped domains, workflow activation, and CRUD management commands.

Architecture model: Open Core — the 8-layer engine lives in aios-core (open source), memory integration is feature-gated in aios-pro.

Quick Start

Verify SYNAPSE is Active

SYNAPSE runs automatically via the Claude Code hook. To check status:

code
*synapse status

This shows: active domains, current bracket, session info, and loaded layers.

Basic Commands

CommandWhat it does
*synapse statusShow current engine state
*synapse domainsList all registered domains
*synapse debugShow detailed debug info (manifest parse, load times, rule counts)
*synapse helpShow all available synapse commands
*briefSwitch to brief response mode
*devSwitch to developer mode (code-focused)
*reviewSwitch to code review mode

Create a Custom Domain

code
*synapse create

This walks you through creating a new domain file + manifest entry. See references/domains.md for the full domain guide.

Architecture

SYNAPSE operates as a 4-layer architecture:

code
.claude/hooks/synapse-engine.js          # Layer 1: Hook Entry (~50 lines)
        |
        v imports
.aios-core/core/synapse/                 # Layer 2: Engine Modules
|-- engine.js                            #   SynapseEngine class
|-- layers/                              #   8 layer processors (L0-L7)
|-- session/session-manager.js           #   Session state (JSON v2.0)
|-- domain/domain-loader.js              #   Manifest + domain parser
|-- context/context-tracker.js           #   Bracket calculation
|-- memory/memory-bridge.js              #   Pro-gated MIS consumer
|-- output/formatter.js                  #   <synapse-rules> XML
        |
        v reads/writes
.synapse/                                # Layer 3: Runtime Data
|-- manifest                             #   Central domain registry (KEY=VALUE)
|-- constitution, global, context        #   Core domains (L0, L1)
|-- agent-*, workflow-*                  #   Scoped domains (L2, L3)
|-- commands                             #   Star-command definitions (L7)
|-- sessions/, cache/                    #   Session state (gitignored)
        |
        v user-invoked
.claude/commands/synapse/                # Layer 4: CRUD Commands + Skill Docs
|-- manager.md                           #   Router/dispatcher
|-- tasks/ (6 tasks)                     #   create, add, edit, toggle, command, suggest

Key principle: SYNAPSE is a consumer of existing systems (UAP for session state, MIS for memories). It never rewrites code from other epics.

References

Reference Guides

GuideDescription
domains.mdDomain types (L0-L7), KEY=VALUE format, creation guide
commands.mdStar-commands, *synapse sub-commands, CRUD operations
manifest.mdManifest format specification, all valid keys
brackets.mdContext bracket system, token budgets, layer activation
layers.md8-layer processor architecture, priority, conflict resolution

Assets (Templates)

Templates for creating custom domains and manifest entries are maintained at:

  • Domain template: .claude/commands/synapse/templates/domain-template
  • Manifest entry template: .claude/commands/synapse/templates/manifest-entry-template

See assets/README.md for details.

CRUD Commands

For domain management operations, use the SYNAPSE manager:

CommandPurpose
*synapse createCreate new domain + manifest entry
*synapse addAdd rule to existing domain
*synapse editEdit or remove rule by index
*synapse toggleToggle domain active/inactive
*synapse commandCreate new star-command
*synapse suggestSuggest best domain for a rule

Full details: references/commands.md

Key Files

FilePurpose
.claude/hooks/synapse-engine.jsHook entry point (UserPromptSubmit)
.aios-core/core/synapse/engine.jsSynapseEngine orchestrator
.synapse/manifestDomain registry (KEY=VALUE)
.synapse/commandsStar-command definitions
.claude/commands/synapse/manager.mdCRUD command router