Skip to content

Shiaoming123/loading-mind

Repository files navigation

Loading Mind

Loading Mind is a runnable Agent Process OS prototype for long-running AI research tasks. It turns waiting time into an observable work surface: tool calls, observations, evidence, claims, and report sections are streamed into a live process graph while the run is still happening.

The product is no longer a prerecorded loading demo. A user submits a research question, the local Agent runtime creates a run, streams live events over SSE, calls limited real tools, grows a knowledge graph, and writes a final report whose sections map back to source nodes. Tool failure is also first-class: failed calls remain visible in the graph and stop or degrade the run according to explicit runtime rules.

What It Does

  • Runs a local Agent runtime through Vite middleware.
  • Streams run events over Server-Sent Events.
  • Visualizes task intent, research plans, search branches, sources, evidence, verification, examples, visualizations, claims, and report sections as a force-directed canvas.
  • Exposes tool I/O, source refs, episodes, attributes, and report mapping through a node inspector.
  • Fails loudly when critical tools fail instead of silently synthesizing from empty results.
  • Runs the default demo_deep_research orchestration with an 8-12 source budget, cross-checking, example generation, and structured report blocks.
  • Persists local run events under .agent-runs/ for inspection while keeping them out of git.

Tech Stack

  • React 18
  • Vite
  • TypeScript
  • D3 force simulation
  • Framer Motion
  • Vitest
  • Local Node/Vite middleware for the runtime API

Run

npm install
npm run dev

Open the local Vite URL shown in the terminal.

The Vite dev server also mounts the local runtime API:

  • POST /api/runs creates an Agent run.
  • GET /api/runs/:runId/events streams Agent events with SSE.
  • POST /api/runs/:runId/pause pauses the run.
  • POST /api/runs/:runId/resume resumes the run.
  • POST /api/runs/:runId/cancel cancels the run.
  • POST /api/runs/:runId/retry appends a visible retry node for a failed tool.
  • POST /api/runs/:runId/exclude marks an evidence node as excluded.

Recorded run events are persisted under .agent-runs/ and ignored by git.

Vercel Demo Deployment

The app can run as a public Vercel demo without long-lived server memory. In production, POST /api/runs returns a completed run snapshot with replayable events, and the frontend replays those events locally. This keeps the demo compatible with serverless functions while preserving the visible Agent process.

Vercel endpoints:

  • POST /api/runs creates and completes a serverless snapshot run.
  • GET /api/diagnostics reports delivery mode, orchestration metadata, registered tool runners, and basic network probes.

Default public run interface:

  • runMode: "demo" for stable sandbox playback or "live" for real tool execution
  • researchMode: "demo_deep_research"
  • sourceBudget: 12 with a hard cap of 12
  • visualization: "auto"

Useful environment variables:

  • LOADING_MIND_PROVIDER_API_KEY, MIMO_API_KEY, or OPENAI_API_KEY supplies the provider key server-side.
  • TAVILY_API_KEY enables Live search through Tavily.
  • BRAVE_SEARCH_API_KEY enables Brave Search as the first Live search fallback.
  • FIRECRAWL_API_KEY enables Firecrawl Search and Scrape fallback.
  • EXA_API_KEY enables the allowlisted exa.search MCP-style semantic search adapter.
  • LOADING_MIND_DEMO_MODE=1 allows demo fallback observations when external tools are unavailable.
  • LOADING_MIND_FORCE_DEMO_TOOLS=1 forces built-in demo tool outputs for public trial stability.

Demo mode keeps sandbox fallbacks available for a stable public presentation. Live mode disables silent demo fallbacks: search runs through Tavily, then Brave Search, then Firecrawl Search when keys are configured. Failed runs record structured error logs and render a failure report with run id, failed tool, error type, redacted input summary, and next action.

In local development, search keys can be provided either through .env.local or the matching key fields in the run configuration form. Form values are used only for the submitted run and are not written into run metadata.

Local development still uses the Vite middleware and SSE runtime so pause, resume, cancel, retry, and exclude interactions remain available while iterating.

Demo Script

  1. Enter a real research question and start the run.
  2. Watch the graph grow from task intent to research plan, search branches, sources, evidence cards, verification, examples, visualizations, and report sections.
  3. Click a node to inspect summary, attributes, episodes, source refs, tool input/output, and report mapping.
  4. Pause/resume/cancel the run from the control cluster.
  5. Retry a failed tool node or exclude an evidence node from the inspector.
  6. When the long report appears, open the right-side report drawer to inspect rendered Markdown, source matrix, cross-check table, Mermaid structure, and claim graph.
  7. Click a section or block to highlight the source graph path.

Design Intent

  • Waiting is treated as an observable work surface, not an empty spinner.
  • Tool calls are first-class graph nodes; success and failure are both visible.
  • Evidence nodes carry source refs and quotes, so users can inspect what the Agent used.
  • Claims and report sections are generated from visible process nodes after cross-checking source support.
  • Visual blocks make the report inspectable before reading every paragraph.
  • The final report is not detached from the process; every section maps back to source node IDs.

Runtime Failure Rules

  • web_search failure stops the run and emits run_failed.
  • web_fetch failure can continue only when search still returned usable observations; the graph records a degraded observation.
  • evidence_extract, llm_analyze, and report_write failures stop the run before normal report synthesis.
  • report_write output is validated before completion; malformed reports are normalized when possible or converted into a failure report.
  • Failed tool nodes stay visible and inspectable instead of being replaced by empty evidence.

Project Updates

Project update rules live in docs/PROJECT_UPDATES.md. Keep user-facing changes reflected in CHANGELOG.md, and run the verification commands below before publishing.

Verification

npm test
npm run build

Repository Status

This repository is the first public version of the Loading Mind prototype. The project is intended for product and engineering iteration, not production deployment.

About

Agent Process OS prototype for visible long-running AI research workflows

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors