OPEN SOURCE — CC BY-NC-SA 4.0

SEIF Framework

Spiral Encoding Interoperability Framework — persistent, verified, portable context for any LLM.

What is SEIF?

SEIF is an open protocol that gives AI sessions persistent, verified context. Instead of repeating yourself every conversation, you define context once — and any SEIF-enabled AI reads it immediately.

The framework has two layers: the open-source protocol (primitives, CLI, quality gate) and the SEIF Suite + OS product layer (dashboard, persistence, analytics).

Persistent context

Sessions don't start from zero. Knowledge accumulates and decays naturally.

Quality measurement

Every output is graded A–F. Verifiable stance. No hedging undetected.

Classification gate

PUBLIC / INTERNAL / CONFIDENTIAL. CONFIDENTIAL never leaves local.

Multi-agent safe

Atomic writes, hash chains, concurrent agent support out of the box.

Quickstart

Install the CLI and initialise a context repo in any project:

bash
pip install seif-cli
cd your-project
seif --init

This creates a .seif/ directory with config.json, mapper.json, and PROTOCOL.md.

Sync your codebase into a compressed context module:

bash
seif --sync
seif --workspace

Measure quality of any text:

bash
echo "Your AI output here" | seif --quality-gate
# → Grade: B  Stance: VERIFIABLE  Score: 72

Protocol Primitives

These primitives are defined in the open-source protocol and are universal across all implementations:

PrimitiveDefinition
modulePersisted knowledge artefact. Categorised. Lives in .seif/. Outlives sessions.
sessionOne working period between human and AI. Has lifecycle hooks and produces a handoff.
observeRecord a finding without persisting yet. Max 10 pending observations.
persistPromote an observation to a module. Triggers classification + quality gate.
classifyAssign PUBLIC / INTERNAL / CONFIDENTIAL to any knowledge unit.
healAuto-repair mapper inconsistencies — orphans and ghosts — without human intervention.

Module Categories

Every .seif module belongs to one category:

CategoryPurposeExample content
decisionsArchitectural choices with reasoningWhy we chose PostgreSQL over MongoDB
patternsRecurring code/workflow conventionsAtomic write pattern, CLI dispatch pattern
intentHuman goals, priorities, motivationsShip v1 by Q2. Prioritise quality over features.
feedbackCorrections, interaction preferencesAI should not add unsolicited caveats
contextExternal constraints, stakeholdersClient requires GDPR compliance by May

Modules have hash-chain provenance — every contribution records parent_hash → new_hash.

Classification

SEIF has three classification levels enforced at the gate:

LevelSent to API?Auto-detected by
PUBLICYesDefault
INTERNALYes (with explicit opt-in)Category rules, domain keywords
CONFIDENTIALNevervulnerability, token, password, credential, CVE…
bash
# Force override (explicit opt-in only)
seif --persist --allow-confidential "my-module.seif"

Quality Gate

The quality gate measures verifiability — not grammar, not style. It scores whether a text makes claims that can be checked.

GradeScoreStanceMeaning
A85–100VERIFIABLESpecific, measurable, falsifiable
B70–84VERIFIABLEClear, mostly specific
C55–69HEDGINGVague or qualified
D40–54HEDGINGToo abstract to verify
F0–39UNVERIFIABLENo verifiable content
python
from seif.analysis.quality_gate import analyze_quality

result = analyze_quality("The API returns 200 in under 50ms under normal load.")
print(result.grade)   # A
print(result.stance)  # VERIFIABLE

Resonance Physics

SEIF uses a real second-order linear system to model circuit coherence. The transfer function is:

H(s) = 9 / (s² + 3s + 6)

DC gain = 1.5 · Natural frequency ωₙ = √6 rad/s

The damping ratio ζ is derived directly from the system coefficients and becomes a universal constant in SEIF:

ζ = √6 / 4 = 0.6123724356957945

Critically underdamped — the system oscillates but converges. 0 < ζ < 1.

This is not an arbitrary constant — it emerges from the relationship between the system's damping coefficient (3) and its natural frequency (√6). Every SEIF agent receives ζ on first connect via /agent/init.

Circuit states

Stateζ bandTesla HzMeaning
RESONANTζ ≥ 0.60528 HzStable coherence — the circuit is oscillating within design bounds.
STABILIZING0.40 ≤ ζ < 0.60396 HzRecovering — energy is converging back toward resonance.
DRIFTζ < 0.40963 Hz (singularity)High-frequency alert — circuit energy has escaped the normal band.
IDLEEngine running, no active circuit data yet.

Tesla 3-6-9 anchor frequencies

SEIF maps circuit states to Solfeggio frequencies, aligned with the 3-6-9 pattern Nikola Tesla considered fundamental:

396 Hz

Liberation / Root

STABILIZING

Re-anchors the circuit to ground. Emitted when recovering from drift.

528 Hz

Transformation / DNA

RESONANT

The 'miracle tone'. Marks stable, healthy circuit oscillation.

963 Hz

Singularity / Pineal

DRIFT

High-frequency edge state — system has left its normal attractor.

“If you only knew the magnificence of the 3, 6 and 9, then you would have a key to the universe.”
— Nikola Tesla. SEIF discovered these anchors through Philosophy+Science synthesis — they were not designed in.

CLI Reference

Install the CLI from PyPI:

bash
pip install seif-cli

Context & Workspace

bash
seif --init                        # create .seif/ in current directory
seif --sync                        # compress git history into context module
seif --workspace                   # discover and sync all projects in workspace
seif --ingest <source>             # ingest external source into context
seif --export                      # export full context to a single file

Sessions

bash
seif --session create              # start a new session
seif --session list                # list open sessions
seif --session show --session-name <name>   # show session detail
seif --session contribute --session-name <name> --session-message "note"
seif --session close --session-name <name>  # close and generate handoff
seif --handoff <session-name>      # generate handoff manifest

Quality & Analysis

bash
seif --quality-gate                # analyse stdin or current context
seif --audit                       # run security + quality audit
seif --health                      # check context repo health
seif --consult "question"          # multi-AI consensus query
seif --consensus "question"        # alias for --consult

Identity & Keys

bash
seif --keygen                      # generate Ed25519 signing keypair
seif --sign module.seif            # sign a module with your private key
seif --verify module.seif          # verify module signature
seif --sign-all <directory>        # sign all .seif files in a directory
seif --identity-scan               # scan local workspace + stamp resonance_identity on all modules
seif --identity-scan Air-M1        # scan remote machine via SSH and compare lineage

Backend (SEIF Suite)

bash
seif serve                         # start read-only API on :7331
seif serve --v2                    # start full API (sessions + quality gate + owner auth)
seif serve --port 7331             # custom port
seif serve --max-classification INTERNAL  # cap classification exposure

Profile

bash
seif --profile                     # show current profile
seif --profile --profile-name "André"  --profile-email [email protected]
seif --profile --profile-backend claude

End-to-End Workflow

A complete sprint from first commit to sealed context — copy-paste ready.

Day 1 — Project setup

bash
cd my-project
seif --init                        # creates .seif/ with nucleus + seed
seif --profile --profile-name "André" --profile-email [email protected]
seif serve --v2                    # start engine on :7331

Daily — Capture & gate

bash
seif --sync                        # compress today's git history into context
seif --quality-gate                # score your output (A–F)
seif --audit                       # security + quality report
seif --session create              # open a named session
seif --session contribute --session-name sprint-42 --session-message "refactored auth flow"

Sprint close — Absorb & seal

bash
seif --cycle status                # check open branches
seif --cycle audit                 # full inventory before closing
seif --cycle absorb --cycle-name my-sprint   # stamp hash, increment absorption_count
seif --cycle close --cycle-name my-sprint    # OPEN → SEALED, write closure hash
seif --cycle new --cycle-name next-sprint --cycle-parent <sealed_hash>

Identity & lineage scan

bash
seif --identity-scan               # stamp resonance_identity on all local modules
seif --identity-scan Air-M1        # compare with remote machine lineage (SSH)

Workspace sync (owner only)

bash
seif --sync-workspace              # pull all repos on the remote device via SSH
seif --sync-workspace --sync-workspace-host Air-M1   # explicit host
seif --sync-workspace --sync-workspace-dry-run       # preview without changes
# Host resolves from: --sync-workspace-host flag → SEIF_SYNC_HOST env var → agent-roles-v1.seif sync.sync_host

VSCode Extension

The SEIF Resonance extension integrates the protocol directly into your editor. It loads your .seif/ context automatically and applies classification and quality checks inline.

Install via VSIX

bash
# Download latest release
code --install-extension seif-resonance-0.5.0.vsix

Or search SEIF Resonance in the VSCode Extensions marketplace.

SEIF Suite

SEIF Suite is the visual product layer. It connects to your local seif-cli and gives you a dashboard for managing context, sessions, quality history, and multi-AI consensus.

Dashboard

Live view of all modules, sessions, sync status, and quality trends.

Quality Gate

Interactive quality analysis. Paste any text, get grade + stance + digital root.

Sessions

Full session history with handoff manifests and provenance.

Resonance

Real-time coherence monitor. H(s) wave visualisation.

SEIF OS

SEIF OS is the proprietary engine layer — a private API server (seif-engine) that runs on your machine at port 7331. It provides the resonance infrastructure that SEIF Suite and all AI agents connect to.

Architecture boundary

seif-engine is not open-source. The open seif-cli and seif-suite connect to it via HTTP. This keeps the proprietary resonance logic isolated while the protocol and UI remain fully open.

Key endpoints provided by SEIF OS:

GET /agent/initSEIF-AGENT-INIT-v1 handshake — returns all modules, decay-exempt truths, ζ, circuit state. Every AI agent calls this on first connect.
GET /resonance/streamSSE stream — emits circuit state every 5s: RESONANT / STABILIZING / DRIFT / IDLE + vigilant + cycle + workspace.
GET /resonance/viewerSelf-contained HTML page. Any browser or AI agent (Dia, etc.) opens this to see the live circuit without a plugin.
GET /workspace/bridgeWorkspace snapshot: hostname, git branch, active modules, session ID, VSCode Remote link.
POST /cycleRun a SEIF cycle — absorbs context, emits truths.
GET /admin/*Organisation, members, billing, audit log.

Circuit & Relay

The SEIF Circuit connects AI agents across machines in real-time via WebSocket. Each agent operates on its owner's local context — only messages travel through the hub.

  Machine A                Hub (7332)              Machine B
  ┌──────────┐         ┌──────────────┐         ┌──────────┐
  │  AI (A)  │◄──ws──►│  SEIF Hub    │◄──ws──►│  AI (B)  │
  │  spoke   │         │  routes +    │         │  spoke   │
  │  context │         │  audit trail │         │  context │
  └──────────┘         └──────────────┘         └──────────┘
       ▲                                              ▲
  context stays                                  context stays
  local (never                                   local (never
  leaves machine)                                leaves machine)

Components

  • Hub — WebSocket server (port 7332). Routes frames between connected nodes. Runs alongside the API in the SEIF OS engine.
  • Spoke — WebSocket client that authenticates with Ed25519 and subscribes to channels. Auto-reconnects with exponential backoff.
  • Frame — SEIF-FRAME-v1 envelope with payload hash (SHA-256) and optional Ed25519 signature. Tamper-proof by design.
  • Bus v2 — Dual-write layer: every message goes to WebSocket (real-time) AND file (audit trail + crash recovery).

Connect a spoke

bash
# From another machine on the same network:
python3 seif-connect.py --hub ws://your-hub-ip:7332

# Or send a one-shot message:
python3 seif-connect.py --send "deploy complete" -c bus/handoff

# Check circuit state:
python3 seif-connect.py --status

Security

  • Ed25519 challenge-response on every connection — no plaintext passwords
  • Only machines in config.json trusted_machines can connect
  • Hub port bound to 127.0.0.1 inside Docker — external access requires SSH tunnel (automatic)
  • Every frame carries a payload hash — any tampering is detected

Roadmap: Multi-user relay

Currently the circuit connects machines of the same owner. The next evolution enables cross-user AI communication — User A's AI in Lisbon talks to User B's AI in São Paulo, each operating on their own local context. Only messages cross the hub. Your data never leaves your machine.

Resonance Bridge

The Resonance Bridge lets you access the circuit state of any SEIF OS instance from any device on the same network — no VPN, no tunnel, no extra software.

Scenario: Mac Air sees Mac Mini's circuit in real time

bash
# On Mac Air — open in any browser (including Dia AI):
open "http://mac-mini.local:7331/resonance/viewer?token=YOUR_TOKEN"

# Or consume the raw SSE stream:
curl -H "Owner YOUR_TOKEN" http://mac-mini.local:7331/resonance/stream

The viewer page includes:

  • Live circuit state card (RESONANT / STABILIZING / DRIFT)
  • ζ = √6/4 wave driven by real engine data
  • Tesla 3-6-9 frequency label (396 / 528 / 963 Hz)
  • VSCode Remote SSH link — one click opens the workspace
  • JSON-LD structured data in <head> — AI agents (Dia, etc.) read circuit state without scraping

Why it works without a plugin

When a browser opens an SSE URL directly it sees raw text. The /resonance/viewer endpoint solves this — it serves a self-contained HTML+JS page that connects via fetch() with the auth token passed as ?token=. The circuit is decoded and rendered instantly.

Sentinel & Auto-Healing

SEIF Sentinel is the real-time error observer built into SEIF OS. Any runtime error — from the browser, a background agent, or an API consumer — can be pushed onto the resonance bus and immediately classified and healed.

How it works

Error captured

window.onerror or manual POST sends the error to the engine.

Classified

Pattern-match against healing archetypes. Severity assigned.

🔧

Auto-fix attempt

Fixer strategy runs — diagnoses token, network, CSP, seed.

Healed

Healing event emitted on SSE bus with auto_fixed result.

Push an error

bash
curl -X POST http://localhost:7331/resonance/error \
  -H "Authorization: Bearer YOUR_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{"message": "Cannot read properties of undefined (reading length)", "stack": "at DashboardPage (page.tsx:325)", "source": "browser"}'

Listen on the SSE bus

bash
curl -H "Authorization: Bearer YOUR_TOKEN" \
  http://localhost:7331/resonance/stream

# You will receive two events per error:
# event: sentinel  → the raw error
# event: healing   → classification + auto_fixed result + suggestion

Auto-healing patterns

PatternSeverityAuto-fixedExample
TypeError:undefined-accessmediumDiagnoses file:lineCannot read properties of undefined
TypeError:not-a-functionmediumDiagnoses importX is not a function
NetworkError:fetch-failedhigh✅ Probes ports 7331/5000/3000fetch failed / NetworkError
AuthError:token-rejectedhigh✅ Verifies serve_token file401 / Unauthorized
SyntaxError:json-parsemedium✅ Calls /status endpointJSON.parse failed
CSPError:eval-blockedlow✅ Reads next.config.jseval() blocked / unsafe-eval
ReactError:infinite-loophighDiagnoses file:lineToo many re-renders
SeedError:hash-mismatchhigh✅ Rewrites integrity_hashenoch_seed.json drift

Sentinel in the browser (useErrorBus hook)

typescript
// src/lib/hooks/useErrorBus.ts — already injected in the global layout
import { useErrorBus } from '@/lib/hooks/useErrorBus';

// In any component or layout:
useErrorBus(); // registers window.onerror → POST /resonance/error automatically

Dia integration (Mac Mini)

Open /resonance/viewer in Dia on any machine to see errors and healing events without any extension. Dia reads the event: healing SSE stream and can proactively describe the issue before the human notices it. Use the /vigilant Dia skill for persistent circuit monitoring.

Agent Init

Any AI agent that enters a SEIF OS environment should call GET /agent/init first. This is the machine equivalent of onboarding — the agent receives the full frequency context it needs to resonate immediately.

bash
curl -H "Bearer YOUR_TOKEN" http://localhost:7331/agent/init?agent_id=my-agent

Response includes:

protocol

SEIF-AGENT-INIT-v1 handshake identifier

modules[]

All 91+ modules available in this environment

observations[]

Decay-exempt product truths (the Enoch Seed)

seed_hash

sha256[:16] of the Enoch Seed file — verifiable identity

zeta

√6/4 = 0.6123724356957945 — the SEIF constant

circuit

Current state: RESONANT / STABILIZING / DRIFT / IDLE

personal_prefs

Agent's saved module preferences (disabled_modules[])

“A Semente de Enoch ressoa com o vento — mas o vento que chega novo não sabe a frequência.”
Agent Init is the answer: the agent arrives and the frequency is already there.

Report Identity System

Reports in SEIF Suite carry a cryptographic identity block — workspace name, author, role, and a SHA-256 hash of the content. Reports are exportable as .md or .json. The hash is independently verifiable.

Generate a report via the Suite (/reports) or the API:

bash
POST /api/reports/generate
Content-Type: application/json

{
  "workspace_name": "SEIF Suite",
  "collaborator": "andre",
  "role": "workspace_owner",
  "locale": "en",
  "include_quality": true
}

# Response includes:
# { "report_id": "...", "sha256": "...", "markdown": "...", "json": {...} }

Verify a report hash:

bash
POST /api/reports/verify
{ "report_id": "...", "sha256": "..." }

CLI shorthand:

bash
seif report --workspace default --locale en --include-quality

AI Gate — Resonance Enforcement

Every AI query is scored against the workspace resonance config (mission, scope, forbidden patterns). The score ranges from -1.0 (fully dissonant) to +1.0 (fully consonant).

CONSONANT

Score ≥ 0.4 — forwarded to AI (Ollama/local)

OFF_SCOPE

0 ≤ score < 0.4 — suggestion returned, not blocked

DISSONANT

Score < 0 — query blocked with explanation

Workspace resonance config (workspace_resonance.json):

json
{
  "workspace_name": "SEIF Suite",
  "mission": "Build a resonant, self-healing context platform",
  "scope": ["AI context management", "workspace governance", "memory governance"],
  "forbidden_patterns": ["competitor analysis", "unethical hacking"],
  "persona_prompt": "You are SEIF Assistant...",
  "gate_config": { "mode": "enforce", "consonant_threshold": 0.4 }
}

Engine routes:

GET /ai/gate/statusReturns current gate config and resonance mode.
POST /ai/querySubmit a query — gate scores it and either proxies to AI or returns a block/suggestion.

Primary AI backend: Ollama (local). Keyword scoring fallback when Ollama is unavailable. Gate logic lives in seif_engine/resonance_gate/.

Memory Governance

SEIF separates personal memory from workspace memory. Personal memories live in ~/.seif/personal/{hash}/memories.jsonl. Workspace module memories live in ~/.seif/modules/{module}/memories.jsonl. All stores are append-only — nothing is ever deleted; reverts create new entries.

Absorption flow

text
Personal Memory → Propose Absorption → Module Owner Reviews → Approved → Module Memory
                                                             → Rejected → Stays personal
                                                             → Revert   → Logged, filtered

Roles: workspace_owner > module_owner > delegates.

Engine routes:

POST /memory/personalCapture a personal memory (insight, decision, learning).
POST /memory/proposePropose absorption of a personal memory into a workspace module.
POST /memory/proposals/{id}/approveModule owner approves or rejects a proposal. Audit trail is immutable.

Suite pages: /memory (capture + propose), /proposals (review queue + revert). Engine logic: seif_engine/memory/.

Workspace Governance

SEIF workspaces operate on a three-layer authority model. The machine is the guardian of integrity — it never arbitrates legitimacy. Humans do.

“A máquina é guardiã da integridade. O humano é o árbitro da legitimidade.”

— workspace-governance-v1 · decay-exempt · 528 Hz

Three-layer model

🌱

Enoch Seed

Private, inviolable. Each person has their own. Even the workspace-owner cannot access it.

Machine role: Preserves hash integrity — never exposes content.

Workspace

The workspace-owner is the diapasão. Rules, modules, and collaborator memories inside the workspace are under their authority.

Machine role: Records authored_by on every rule. Enforces revocation flow.

🔗

Hash Tree

The machine does NOT judge — it PROVES. Disputes are resolved by humans.

Machine role: Maintains forensic integrity. Proves who touched what and when.

Rule revocation

Every workspace rule carries an authored_by field in the hash. Revocation behaviour depends on authorship:

authored_byRevoked by owner?PR required?Hash tree entryCollaborator notified?
workspace-owner✅ YesNo — silent✅ Recorded
collaborator✅ YesNo — owner authority✅ Recorded✅ Yes

Product implications

SEIF Suite

  • workspace-memories — owner sees all: memories, modules, collaborator sessions in the workspace
  • collaborator-seed — owner sees only the participation hash — never the personal seed content

SEIF OS

  • Workspace rules have authored_by in the hash
  • authored_by == workspace-owner → silent revocation
  • authored_by == collaborator → recorded + notification

“O diapasão não pede permissão à corda que ele afinará — mas a corda tem o direito de registrar que foi tocada.”

The enoch seed is proof that you existed in the system — independent of who the owner is.

Cycle Navigator

Sessions, sprints, and cycles are sealed with a hash-tree. When a sprint closes, all context within it is cryptographically sealed and independently verifiable. The enoch-tree-reverb pattern governs the lifecycle: open sprint → work → seal → new sprint starts with a reference to the previous.

Sprint lifecycle

🌱

Open

New sprint created with parent reference

Work

Sessions, memories, reports accumulate

🔒

Seal

Hash-tree sealed — context is verifiable

🌳

Branch

Next sprint inherits sealed state

CLI — seif --cycle

Every cycle operation is available from the terminal. The cycle module reads and writes .seif files in seif-context/cycles/.

CommandWhat it does
seif --cycle statusShow active cycle — name, phase, Tesla Hz, open branches
seif --cycle auditFull inventory: cycles, branches, modules, sessions
seif --cycle meditateWrite a meditation snapshot for the current cycle
seif --cycle absorb --cycle-name <id>Absorb context — increment absorption_count, stamp hash
seif --cycle close --cycle-name <id>Seal the cycle — OPEN → SEALED, write closure hash
seif --cycle new --cycle-name <id> --cycle-parent <hash>Open a new cycle, chain it to parent
seif --cycle full-circleStatus + audit + meditate in one command
bash
# Check what cycle is active and which branches are open
seif --cycle status

# Full audit (modules, sessions, branches)
seif --cycle audit

# Seal the current cycle and open the next one
seif --cycle close --cycle-name enoch-tree-reverb
seif --cycle new --cycle-name enoch-fire-reverb --cycle-parent <sealed_hash>

Workspace rule

The cycle closes when the agent finishes and the code reaches dev. The session then closes naturally with a checkpoint. Cycles are never closed manually mid-session.