Skip to content

noteMASTER11/ai-fabric

Repository files navigation

AI Fabric

AI Fabric is a UX-first orchestration studio for building and running connected sub-agent workflows with:

  • multi-workspace management
  • visual graph editor for agent topology
  • configurable worker/reviewer nodes
  • conditional human-in-the-loop gate (only when worker has assigned reviewer)
  • persistent run history (prompts, outputs, decisions)
  • full flow execution from entry prompt (entire configured chain)
  • model discovery via OpenAI models.list()
  • local RAG memory with SQLite chunks + embeddings JSON + rerank
  • runtime provider per node (openai_api or cursor_bridge)
  • session controls per node (clear context, switch dialog)
  • bridge API contract document at docs/cursor-bridge-contract.md

Current MVP

Implemented now:

  • Workspace creation/list page
  • Workflow editor based on React Flow
  • node configuration (name, role, model, instructions, reviewer, success criteria)
  • node runtime controls (provider, temperature, clear-context-on-run)
  • workspace switcher directly in studio header
  • graph persistence to SQLite via Prisma
  • run creation and per-node execution
  • run full chain in topological order with pause/resume on review gates
  • modal quality gate with Approve / Reject with note for reviewer-linked workers
  • event persistence in WorkflowRun, NodeRun, HumanDecision
  • API endpoint for available models with fallback list
  • local knowledge base API and UI:
  • add documents
  • auto-chunking
  • embeddings generation (OpenAI or fallback local embedding)
  • hybrid rerank search (semantic + lexical)
  • RAG context injection into node execution
  • agent session API:
  • list sessions by workspace
  • clear context
  • switch dialog
  • cursor bridge runtime adapter with OpenAI fallback

Tech Stack

  • Next.js 16 (App Router, API routes)
  • TypeScript
  • React Flow
  • Prisma 7 + SQLite (better-sqlite3 adapter)
  • OpenAI Node SDK (responses API)

Run Locally

  1. Install dependencies:
npm install
  1. Set environment variables:
# .env
DATABASE_URL="file:./dev.db"
OPENAI_API_KEY="" # optional
CURSOR_BRIDGE_URL="http://127.0.0.1:4141" # optional, bridge adapter endpoint
# optional codex fallback controls:
# CODEX_BIN="C:\\Users\\User\\.cursor\\extensions\\openai.chatgpt-...\\bin\\windows-x64\\codex.exe"
# CODEX_EXEC_TIMEOUT_SECONDS="300"
# CURSOR_BRIDGE_TIMEOUT_MS="315000"
  1. Push schema and generate Prisma client:
npx prisma db push
npm run db:generate
  1. Start development server:
npm run dev
  1. (Optional) Start local Cursor bridge runtime:
npm run bridge:dev
  1. Open:
http://localhost:3000

One-click Windows launch

You can also start everything by double-clicking:

start-ai-fabric.bat

This script checks:

  • Node.js and npm availability
  • dependency installation (node_modules)
  • .env presence (creates from .env.example if missing)
  • Prisma client generation + DB sync
  • free ports 3000 and 4141

Useful Scripts

npm run dev
npm run bridge:dev
npm run lint
npm run build
npm run db:generate
npm run db:migrate
npm run db:studio

Data Model (Core)

  • Workspace
  • Workflow (stores graph JSON)
  • WorkflowRun
  • NodeRun
  • HumanDecision
  • AgentSession (prepared for per-node memory/session metadata)
  • KnowledgeDocument
  • KnowledgeChunk

Next Up (Recommended)

  1. Full graph execution engine:
  • topological traversal
  • retries by quality gate
  • conditional branching
  1. Cursor bridge hardening:
  • stream token-level events from bridge to UI
  • strict bridge-only mode toggle (disable fallback by policy)
  • richer bridge diagnostics per node run
  1. Optional RAG upgrade path:
  • move from local SQLite retrieval to pgvector or dedicated vector DB
  • add metadata filters and advanced rerank strategies
  1. Multi-user readiness:
  • auth and roles
  • audit trail and immutable event log
  • workspace permissions

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors