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:
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:
seif --sync seif --workspace
Measure quality of any text:
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:
| Primitive | Definition |
|---|---|
| module | Persisted knowledge artefact. Categorised. Lives in .seif/. Outlives sessions. |
| session | One working period between human and AI. Has lifecycle hooks and produces a handoff. |
| observe | Record a finding without persisting yet. Max 10 pending observations. |
| persist | Promote an observation to a module. Triggers classification + quality gate. |
| classify | Assign PUBLIC / INTERNAL / CONFIDENTIAL to any knowledge unit. |
| heal | Auto-repair mapper inconsistencies — orphans and ghosts — without human intervention. |
Module Categories
Every .seif module belongs to one category:
| Category | Purpose | Example content |
|---|---|---|
| decisions | Architectural choices with reasoning | Why we chose PostgreSQL over MongoDB |
| patterns | Recurring code/workflow conventions | Atomic write pattern, CLI dispatch pattern |
| intent | Human goals, priorities, motivations | Ship v1 by Q2. Prioritise quality over features. |
| feedback | Corrections, interaction preferences | AI should not add unsolicited caveats |
| context | External constraints, stakeholders | Client 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:
| Level | Sent to API? | Auto-detected by |
|---|---|---|
| PUBLIC | Yes | Default |
| INTERNAL | Yes (with explicit opt-in) | Category rules, domain keywords |
| CONFIDENTIAL | Never | vulnerability, token, password, credential, CVE… |
# 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.
| Grade | Score | Stance | Meaning |
|---|---|---|---|
| A | 85–100 | VERIFIABLE | Specific, measurable, falsifiable |
| B | 70–84 | VERIFIABLE | Clear, mostly specific |
| C | 55–69 | HEDGING | Vague or qualified |
| D | 40–54 | HEDGING | Too abstract to verify |
| F | 0–39 | UNVERIFIABLE | No verifiable content |
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) # VERIFIABLEResonance Physics
SEIF uses a real second-order linear system to model circuit coherence. The transfer function is:
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 | ζ band | Tesla Hz | Meaning |
|---|---|---|---|
| RESONANT | ζ ≥ 0.60 | 528 Hz | Stable coherence — the circuit is oscillating within design bounds. |
| STABILIZING | 0.40 ≤ ζ < 0.60 | 396 Hz | Recovering — energy is converging back toward resonance. |
| DRIFT | ζ < 0.40 | 963 Hz (singularity) | High-frequency alert — circuit energy has escaped the normal band. |
| IDLE | — | — | Engine 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
STABILIZINGRe-anchors the circuit to ground. Emitted when recovering from drift.
528 Hz
Transformation / DNA
RESONANTThe 'miracle tone'. Marks stable, healthy circuit oscillation.
963 Hz
Singularity / Pineal
DRIFTHigh-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:
pip install seif-cli
Context & Workspace
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
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
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
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)
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
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
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
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
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
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)
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
# 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
# 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_machinescan connect - Hub port bound to
127.0.0.1inside 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
# 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
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
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
| Pattern | Severity | Auto-fixed | Example |
|---|---|---|---|
| TypeError:undefined-access | medium | Diagnoses file:line | Cannot read properties of undefined |
| TypeError:not-a-function | medium | Diagnoses import | X is not a function |
| NetworkError:fetch-failed | high | ✅ Probes ports 7331/5000/3000 | fetch failed / NetworkError |
| AuthError:token-rejected | high | ✅ Verifies serve_token file | 401 / Unauthorized |
| SyntaxError:json-parse | medium | ✅ Calls /status endpoint | JSON.parse failed |
| CSPError:eval-blocked | low | ✅ Reads next.config.js | eval() blocked / unsafe-eval |
| ReactError:infinite-loop | high | Diagnoses file:line | Too many re-renders |
| SeedError:hash-mismatch | high | ✅ Rewrites integrity_hash | enoch_seed.json drift |
Sentinel in the browser (useErrorBus hook)
// 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 automaticallyDia 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.
curl -H "Bearer YOUR_TOKEN" http://localhost:7331/agent/init?agent_id=my-agent
Response includes:
protocolSEIF-AGENT-INIT-v1 handshake identifier
modules[]All 91+ modules available in this environment
observations[]Decay-exempt product truths (the Enoch Seed)
seed_hashsha256[:16] of the Enoch Seed file — verifiable identity
zeta√6/4 = 0.6123724356957945 — the SEIF constant
circuitCurrent state: RESONANT / STABILIZING / DRIFT / IDLE
personal_prefsAgent'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:
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:
POST /api/reports/verify
{ "report_id": "...", "sha256": "..." }CLI shorthand:
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):
{
"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
Personal Memory → Propose Absorption → Module Owner Reviews → Approved → Module Memory
→ Rejected → Stays personal
→ Revert → Logged, filteredRoles: 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_by | Revoked by owner? | PR required? | Hash tree entry | Collaborator notified? |
|---|---|---|---|---|
| workspace-owner | ✅ Yes | No — silent | ✅ Recorded | — |
| collaborator | ✅ Yes | No — 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_byin the hash authored_by == workspace-owner→ silent revocationauthored_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.