# ferroxlabs/ijfw architecture

> Architecture diagram of the GitHub repository ferroxlabs/ijfw, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-07-08). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ferroxlabs/ijfw
- Repository: https://github.com/ferroxlabs/ijfw

## Overview

1. **What this repository is**
   - IJFW is a **local-first orchestration layer** for AI coding tools, not a single app.
   - The repo is organized around a central **Node.js service** plus many **tool-specific adapters** so Claude, Codex, Gemini, Cursor, Windsurf, Copilot, Aider, and others can share the same memory, workflow, and guardrails.

2. **Top-level architecture**
   - The core runtime lives in `mcp-server/`, which acts as the shared brain and protocol hub.
   - Surrounding it are integration surfaces for each host tool: `claude/`, `codex/`, `gemini/`, `wayland/`, `hermes/`, `cursor/`, `windsurf/`, `copilot/`, `aider/`, `antigravity/`, plus shared rules and skills under `shared/`.
   - The repository also includes the **installer** (`installer/`) and a large **test/fixture corpus** for regression and compatibility checks.

3. **Host-tool integration layer**
   - Each tool gets a different delivery mechanism depending on what it supports: plugin, MCP, hooks, command files, or rules files.
   - Examples:
     - `claude/` and `codex/` include command libraries, hook scripts, and skill packs.
     - `gemini/extensions/ijfw/` packages the same functionality as a Gemini extension with commands, hooks, and policies.
     - `hermes/plugins/ijfw/` and `wayland/plugins/ijfw/` are Python plugin shims for those environments.
   - This layer is the boundary between IJFW’s shared logic and the host agent’s native config/runtime.

4. **Central server and protocol boundary**
   - `mcp-server/src/server.js` is the main server entry point.
   - It exposes the capabilities that tools consume through MCP and related local interfaces.
   - The server stays **localhost-only** and is designed to be the shared backend for all supported clients, rather than a cloud service.

5. **Memory subsystem**
   - The memory engine is a major subsystem under `mcp-server/src/memory/` and `mcp-server/src/brain/`.
   - It stores and retrieves durable context as local files and indexed data, with support for:
     - markdown/obsidian-style notes
     - FTS5 search
     - vector/semantic search
     - temporal and bi-temporal facts
     - promotion/deduplication/staleness logic
   - The flow is: session observations and user decisions are captured locally, indexed, and later recalled into new sessions across tools.

6. **Workflow and discipline engine**
   - IJFW’s “plan before build” behavior is implemented in `mcp-server/src/orchestrator/` and `mcp-server/src/swarm/`.
   - These modules enforce phases such as brief, plan, execute, verify, and ship, with explicit gates rather than silent auto-advance.
   - The workflow layer also coordinates wave planning, review, termination, status, and worktree provisioning, which matters because the agent may split work across parallel branches or specialist runs.

7. **Cross-audit and multi-model review**
   - `mcp-server/src/cross-*.js` and related orchestrator code implement the multi-model review flow.
   - The system selects reviewers from different model lineages, chunks work, dispatches audits, and records findings as consensus or contested.
   - This is a distinct boundary: the reviewer panel is intentionally separate from the model that made the change.

8. **Personalization and “learns you” profile**
   - `mcp-server/src/profile/` captures edits, preferences, exemplars, and telemetry so the system can adapt to a user over time.
   - The profile pipeline is consent-aware: capture, disclosure, and injection are separate concerns, and there are explicit kill-switches and forget/reset paths.
   - Data flow here is from observed corrections or exemplars into a local profile store, then back into future prompt rendering and tool behavior.

9. **Observability, receipts, and dashboard**
   - `mcp-server/src/dashboard-server.js`, `dashboard-aggregator.js`, and the `scripts/dashboard/` utilities turn local logs into a live session dashboard.
   - The repo’s observability model is event-driven: each tool call or session action becomes a local record, then the dashboard aggregates cost, cache savings, memory hits, and audit outcomes.
   - This is deliberately offline and inspectable; the dashboard is a local artifact, not a hosted product.

10. **Cost/routing optimization**
   - `mcp-server/src/cost/`, `src/model-refresh.js`, and related routing code manage model selection and pricing-aware accounting.
   - The system uses cheaper models for read-heavy or routine tasks and reserves stronger models for architecture/review tasks.
   - Cost reporting is tied to actual usage logs and cache behavior, not synthetic estimates.

11. **Design contract and specialist skills**
   - Design support is a first-class subsystem: `mcp-server/src/design*`, `mcp-server/templates/design/`, and the mirrored skill packages under `shared/skills/` and tool-specific skill directories.
   - “Skills” are the bounded specialist modules that get loaded on demand rather than kept resident.
   - This repo uses that pattern broadly: workflow skills, design skills, debug/review skills, memory skills, and team-generation skills all sit beside the core system and are dispatched by intent.

12. **Installer and machine-level setup**
   - `installer/` is the packaging and mutation layer that wires IJFW into the user’s local tool configs.
   - It handles discovery of supported tools, preflight checks, install/uninstall flows, config backups, and platform-specific gates.
   - The installer is where the repo crosses from “source code” into “machine state,” which is why it has dedicated checks for integrity, smoke tests, and rollback safety.

13. **Platform-specific shims**
   - The repo includes multiple front doors for different ecosystems:
     - Node-based adapters and CLIs
     - Python plugin shims for Hermes/Wayland
     - PowerShell support for Windows installation
     - shell scripts for hooks, smoke tests, and maintenance
   - These wrappers are thin; the shared logic lives in `mcp-server/` and shared skill/rule assets.

14. **Validation, fixtures, and regression safety**
   - The repository is heavily test-driven, with extensive coverage in `mcp-server/test*`, `installer/test*`, `hermes/plugins/ijfw/tests`, and `wayland/plugins/ijfw/tests`.
   - Fixtures model real project types, memory behavior, cross-audit cases, truncation recovery, and platform-specific edge cases.
   - This matters architecturally because the repo’s complexity is in integration behavior across tools, not in a single algorithmic core.

15. **Main data flow to draw**
   - User action enters through a host tool.
   - Tool-specific hook/plugin/rules layer captures the prompt or event.
   - The shared server resolves memory, profile, workflow, or audit actions.
   - Results are injected back into the tool, while receipts, logs, and state are persisted locally.
   - The dashboard and benchmark tooling read the same local artifacts for visibility and validation.

16. **Key boundaries to preserve in a diagram**
   - **Host tool boundary:** each editor/CLI has its own adapter surface.
   - **Shared local brain boundary:** `mcp-server` centralizes logic and state.
   - **Local storage boundary:** memory, profile, receipts, and config all live on disk.
   - **Review boundary:** cross-audit is separate from the generating model.
   - **Installer boundary:** setup/uninstall is a distinct machine-state mutation path.
   - **No cloud backend boundary:** the architecture is intentionally offline-first and user-controlled.

Main entry points: [`mcp-server/src/server.js`](https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/server.js) (Server entry), [`installer/src/install.js`](https://github.com/ferroxlabs/ijfw/blob/main/installer/src/install.js) (Installer core), [`claude`](https://github.com/ferroxlabs/ijfw/tree/main/claude) (Claude), [`codex`](https://github.com/ferroxlabs/ijfw/tree/main/codex) (Codex)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_host_integrations["Host integrations"]
  node_claude_surface["Claude<br/>integration surface"]
  node_codex_surface["Codex<br/>integration surface"]
  node_gemini_surface["Gemini<br/>integration surface"]
  node_cursor_surface["Cursor<br/>integration surface"]
  node_windsurf_surface["Windsurf<br/>integration surface"]
  node_hermes_surface["Hermes<br/>integration surface"]
  node_wayland_surface["Wayland<br/>integration surface"]
  node_antigravity_surface["Antigravity<br/>integration surface"]
end

subgraph group_core_server["Core server"]
  node_mcp_server_entry(("Server entry<br/>Node MCP server<br/>[server.js]"))
  node_brain_memory[("Memory brain<br/>memory subsystem")]
  node_brain_runtime["Brain runtime<br/>context engine"]
  node_orchestrator["Workflow engine<br/>discipline orchestration"]
  node_swarm["Swarm<br/>multi-run planner"]
  node_cross_audit["Cross-audit<br/>review pipeline"]
  node_profile["Profile<br/>personalization engine"]
  node_dashboard["Dashboard<br/>observability server"]
  node_cost["Cost routing<br/>pricing and routing"]
end

subgraph group_installer["Installer"]
  node_installer_core["Installer core<br/>setup pipeline<br/>[install.js]"]
  node_installer_preflight["Preflight gates<br/>validation gates"]
end

subgraph group_shared_assets["Shared assets"]
  node_shared_rules["Shared rules<br/>policy bundle<br/>[IJFW.md]"]
  node_shared_skills["Shared skills<br/>skill library"]
  node_shared_design["Design system<br/>specialist skill"]
end

subgraph group_validation["Validation"]
  node_repo_fixtures["Fixtures<br/>regression corpus"]
  node_mcp_tests["MCP tests<br/>integration tests"]
end

node_claude_surface -->|"uses MCP"| node_mcp_server_entry
node_codex_surface -->|"uses MCP"| node_mcp_server_entry
node_gemini_surface -->|"uses MCP"| node_mcp_server_entry
node_cursor_surface -->|"uses MCP"| node_mcp_server_entry
node_windsurf_surface -->|"uses MCP"| node_mcp_server_entry
node_hermes_surface -->|"bridges to server"| node_mcp_server_entry
node_wayland_surface -->|"bridges to server"| node_mcp_server_entry
node_antigravity_surface -->|"configures access"| node_mcp_server_entry
node_shared_rules -->|"shapes behavior"| node_claude_surface
node_shared_rules -->|"shapes behavior"| node_codex_surface
node_shared_skills -->|"packages skills"| node_claude_surface
node_shared_skills -->|"packages skills"| node_codex_surface
node_shared_skills -->|"packages skills"| node_gemini_surface
node_mcp_server_entry -->|"serves memory"| node_brain_memory
node_mcp_server_entry -->|"serves brain"| node_brain_runtime
node_mcp_server_entry -->|"runs workflow"| node_orchestrator
node_mcp_server_entry -->|"coordinates swarm"| node_swarm
node_mcp_server_entry -->|"routes review"| node_cross_audit
node_mcp_server_entry -->|"injects profile"| node_profile
node_mcp_server_entry -->|"emits receipts"| node_dashboard
node_mcp_server_entry -->|"tracks cost"| node_cost
node_installer_core -->|"guards install"| node_installer_preflight
node_installer_core -->|"wires host"| node_claude_surface
node_installer_core -->|"wires host"| node_codex_surface
node_installer_core -->|"wires host"| node_gemini_surface
node_repo_fixtures -->|"drives regressions"| node_mcp_tests
node_mcp_tests -->|"verifies"| node_mcp_server_entry

click node_claude_surface "https://github.com/ferroxlabs/ijfw/tree/main/claude"
click node_codex_surface "https://github.com/ferroxlabs/ijfw/tree/main/codex"
click node_gemini_surface "https://github.com/ferroxlabs/ijfw/tree/main/gemini/extensions/ijfw"
click node_cursor_surface "https://github.com/ferroxlabs/ijfw/tree/main/cursor"
click node_windsurf_surface "https://github.com/ferroxlabs/ijfw/tree/main/windsurf"
click node_hermes_surface "https://github.com/ferroxlabs/ijfw/tree/main/hermes/plugins/ijfw"
click node_wayland_surface "https://github.com/ferroxlabs/ijfw/tree/main/wayland/plugins/ijfw"
click node_antigravity_surface "https://github.com/ferroxlabs/ijfw/tree/main/antigravity"
click node_shared_rules "https://github.com/ferroxlabs/ijfw/blob/main/shared/rules/IJFW.md"
click node_shared_skills "https://github.com/ferroxlabs/ijfw/tree/main/shared/skills"
click node_shared_design "https://github.com/ferroxlabs/ijfw/tree/main/shared/skills/ijfw-design"
click node_mcp_server_entry "https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/server.js"
click node_brain_memory "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/memory"
click node_brain_runtime "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/brain"
click node_orchestrator "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/orchestrator"
click node_swarm "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/swarm"
click node_cross_audit "https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/cross-orchestrator.js"
click node_profile "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/profile"
click node_dashboard "https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/dashboard-server.js"
click node_cost "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/cost"
click node_installer_core "https://github.com/ferroxlabs/ijfw/blob/main/installer/src/install.js"
click node_installer_preflight "https://github.com/ferroxlabs/ijfw/tree/main/installer/src/preflight"
click node_repo_fixtures "https://github.com/ferroxlabs/ijfw/tree/main/test/fixtures"
click node_mcp_tests "https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/test"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_claude_surface,node_codex_surface,node_gemini_surface,node_cursor_surface,node_windsurf_surface,node_hermes_surface,node_wayland_surface,node_antigravity_surface toneBlue
class node_mcp_server_entry,node_brain_memory,node_brain_runtime,node_orchestrator,node_swarm,node_cross_audit,node_profile,node_dashboard,node_cost toneAmber
class node_installer_core,node_installer_preflight toneMint
class node_shared_rules,node_shared_skills,node_shared_design toneRose
class node_repo_fixtures,node_mcp_tests toneIndigo
```

## Components

### Host integrations

Tool-specific entry points, adapters, hooks, rules, and skill bundles for different AI environments.

- [Claude](https://github.com/ferroxlabs/ijfw/tree/main/claude): integration surface · Claude plugin surface with commands, hooks, rules, agents, and skills. · `claude`
- [Codex](https://github.com/ferroxlabs/ijfw/tree/main/codex): integration surface · Codex plugin surface with commands, hooks, config, and mirrored skills. · `codex`
- [Gemini](https://github.com/ferroxlabs/ijfw/tree/main/gemini/extensions/ijfw): integration surface · Gemini extension packaging commands, hooks, policies, and skills. · `gemini/extensions/ijfw`
- [Cursor](https://github.com/ferroxlabs/ijfw/tree/main/cursor): integration surface · Cursor rules and MCP configuration for local IJFW behavior. · `cursor`
- [Windsurf](https://github.com/ferroxlabs/ijfw/tree/main/windsurf): integration surface · Windsurf rules and MCP configuration for local IJFW behavior. · `windsurf`
- [Hermes](https://github.com/ferroxlabs/ijfw/tree/main/hermes/plugins/ijfw): integration surface · Python plugin shim and MCP bridge for Hermes environments. · `hermes/plugins/ijfw`
- [Wayland](https://github.com/ferroxlabs/ijfw/tree/main/wayland/plugins/ijfw): integration surface · Python plugin shim and MCP bridge for Wayland environments. · `wayland/plugins/ijfw`
- [Antigravity](https://github.com/ferroxlabs/ijfw/tree/main/antigravity): integration surface · MCP config front door for Antigravity integration. · `antigravity`

### Core server

Local MCP backend and the shared runtime that holds memory, workflow, review, profile, cost, and dashboard logic.

- [Server entry](https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/server.js): Node MCP server · Main localhost-only server entry point for IJFW capabilities. · `mcp-server/src/server.js`
- [Memory brain](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/memory): memory subsystem · Durable local memory, extraction, search, and recall pipeline. · `mcp-server/src/memory`
- [Brain runtime](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/brain): context engine · Higher-level brain logic for ingestion, promotion, wiki compilation, and guardrails. · `mcp-server/src/brain`
- [Workflow engine](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/orchestrator): discipline orchestration · Plan/execute/verify/ship gating, wave state, worktrees, and status protocol. · `mcp-server/src/orchestrator`
- [Swarm](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/swarm): multi-run planner · Dispatch and planning layer for parallelized work and review flows. · `mcp-server/src/swarm`
- [Cross-audit](https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/cross-orchestrator.js): review pipeline · Chunking, reviewer dispatch, and consensus/contested audit flow. · `mcp-server/src/cross-orchestrator.js`
- [Profile](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/profile): personalization engine · Consent-aware capture, derivation, storage, and injection of user preferences. · `mcp-server/src/profile`
- [Dashboard](https://github.com/ferroxlabs/ijfw/blob/main/mcp-server/src/dashboard-server.js): observability server · Local session dashboard and receipt aggregation from logs and events. · `mcp-server/src/dashboard-server.js`
- [Cost routing](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/src/cost): pricing and routing · Model selection, usage accounting, and cost aggregation. · `mcp-server/src/cost`

### Installer

Machine-state setup and teardown path for wiring IJFW into local tools.

- [Installer core](https://github.com/ferroxlabs/ijfw/blob/main/installer/src/install.js): setup pipeline · Install/uninstall orchestration and machine-state wiring for host integrations. · `installer/src/install.js`
- [Preflight gates](https://github.com/ferroxlabs/ijfw/tree/main/installer/src/preflight): validation gates · Platform and integrity checks before installation or release actions. · `installer/src/preflight`

### Shared assets

Rules, skills, and templates mirrored across tool ecosystems.

- [Shared rules](https://github.com/ferroxlabs/ijfw/blob/main/shared/rules/IJFW.md): policy bundle · Repo-wide IJFW rules shared across hosts. · `shared/rules/IJFW.md`
- [Shared skills](https://github.com/ferroxlabs/ijfw/tree/main/shared/skills): skill library · Canonical skill packs mirrored into host-specific bundles. · `shared/skills`
- [Design system](https://github.com/ferroxlabs/ijfw/tree/main/shared/skills/ijfw-design): specialist skill · Design templates, component snippets, and design reasoning assets. · `shared/skills/ijfw-design`

### Validation

Regression corpus, smoke tests, and fixtures that protect integration behavior.

- [Fixtures](https://github.com/ferroxlabs/ijfw/tree/main/test/fixtures): regression corpus · Repository-wide regression fixtures for memory, project types, and symbol graph behavior. · `test/fixtures`
- [MCP tests](https://github.com/ferroxlabs/ijfw/tree/main/mcp-server/test): integration tests · Core server and workflow regression coverage for orchestration, memory, dashboard, and adapters. · `mcp-server/test`

## Connections

- Claude → Server entry: uses MCP · Claude tooling talks to the shared local server through MCP and hooks.
- Codex → Server entry: uses MCP · Codex tooling talks to the shared local server through MCP and hooks.
- Gemini → Server entry: uses MCP · Gemini extension routes commands and hooks into the shared server.
- Cursor → Server entry: uses MCP · Cursor reads shared behavior from local MCP configuration.
- Windsurf → Server entry: uses MCP · Windsurf reads shared behavior from local MCP configuration.
- Hermes → Server entry: bridges to server · Hermes plugin shim forwards local agent actions into IJFW core services.
- Wayland → Server entry: bridges to server · Wayland plugin shim forwards local agent actions into IJFW core services.
- Antigravity → Server entry: configures access · Antigravity exposes IJFW through local MCP configuration.
- Shared rules → Claude: shapes behavior · Shared rules are mirrored into host-specific rule files and prompts.
- Shared rules → Codex: shapes behavior · Shared rules are mirrored into host-specific rule files and prompts.
- Shared skills → Claude: packages skills · Canonical skills are copied or adapted into Claude-specific bundles.
- Shared skills → Codex: packages skills · Canonical skills are copied or adapted into Codex-specific bundles.
- Shared skills → Gemini: packages skills · Canonical skills are packaged into the Gemini extension.
- Server entry → Memory brain: serves memory · Server routes memory and recall requests into the memory engine.
- Server entry → Brain runtime: serves brain · Server delegates higher-level context and ingestion work to the brain runtime.
- Server entry → Workflow engine: runs workflow · Server exposes discipline phases, status, and worktree orchestration.
- Server entry → Swarm: coordinates swarm · Server delegates parallel planning and dispatch to swarm logic.
- Server entry → Cross-audit: routes review · Server triggers cross-model review and records audit outcomes.
- Server entry → Profile: injects profile · Server captures preferences and reinjects consented user profile data.
- Server entry → Dashboard: emits receipts · Server writes event and receipt data that the dashboard aggregates.
- Server entry → Cost routing: tracks cost · Server feeds usage data into model pricing and savings accounting.
- Installer core → Preflight gates: guards install · Installation and uninstall flows are gated by preflight checks.
- Installer core → Claude: wires host · Installer mutates host configs and hooks for Claude.
- Installer core → Codex: wires host · Installer mutates host configs and hooks for Codex.
- Installer core → Gemini: wires host · Installer mutates host configs and hooks for Gemini.
- Fixtures → MCP tests: drives regressions · Fixtures feed regression suites covering integration and data-shape behavior.
- MCP tests → Server entry: verifies · Tests validate the server, adapters, workflows, memory, and dashboard flows.
