Skip to main content
Back

Psylens AI's NormCode Canvas Fixes the Hidden State Problem Breaking LLM Workflows

A new research paper introduces a scoped workflow language and canvas that turns every LLM checkpoint into a self-contained, reusable case.

Pro

Paper, Full Access
  • Paper by Xin Guan, Yunshan Li, and Ze Wang introduces NormCode Canvas v1.1.3, a deployed CBR system for LLM workflows.
  • NormCode's compiler-enforced scope rule makes every checkpoint a self-contained case with no hidden context.
  • Level 1 CBR treats checkpoints as concrete cases; Fork reuses them, Value Override revises with automatic stale propagation.
  • Level 2 CBR treats compiled plans as abstract cases; the compilation pipeline is itself a NormCode plan.
  • Four deployed plans: PPT Generation at ~40s per slide, Code Assistant, NC Compilations, and Canvas Assistant.
  • Syntactic nodes run at zero LLM cost and make up 60-70% of production plan inferences.

A new arXiv paper by Xin Guan, Yunshan Li, and Ze Wang introduces NormCode Canvas (v1.1.3), a deployed system that tries to fix one of the most annoying facts about building multi-step LLM workflows: you cannot reliably resume, debug, or reuse an intermediate step because the step secretly depends on everything that happened before it.

The authors frame the work through case-based reasoning (CBR), a classical AI paradigm in which new problems are solved by retrieving and adapting past solved cases through a four-stage cycle of retrieve, reuse, revise, retain. CBR depends critically on case integrity: each case must be a self-contained record of a past solution state, free of implicit context. That last property is where today's orchestration stacks fall apart.

Why current LLM workflows leak state

Frameworks like LangChain, LangGraph, AutoGen, and PromptFlow make workflows easy to build but hard to trust. A checkpoint at step k may embed accumulated conversation history or prompt context from earlier steps, making it a snapshot of shared state rather than a self-contained case.

The consequences are familiar to anyone who has shipped an agent to production:

  • Unreliable retrieval: resuming from a saved checkpoint in a new context produces wrong behavior.
  • Non-localizable failures: a bug at step k could originate anywhere in the accumulated implicit state.
  • Irreproducible cases: loading the same checkpoint twice can yield different outputs.

The paper argues these are not tooling gaps but a language problem. Without a workflow representation that structurally isolates each step, no amount of tracing or persistence produces genuinely reusable cases.

NormCode: a scoped plan with three markers

The foundation is NormCode, a semi-formal planning language whose compiler enforces a strict scope rule. Three markers constitute the full syntax: <- Value, <= Functional, and <* Context (loop-current element). Concept names and descriptions are free-form natural-language strings while the three markers and indentation are rigidly enforced.

The critical guarantee: each inference's inputs are exactly the concepts declared in its immediately enclosing block, with no implicit sharing. The compiler determines scope at formalization time; the runtime enforces it. That means every checkpoint stores exactly the bounded inputs a downstream step could need, and nothing else.

A plan lives in three synchronized forms: .ncds (human-authored, reads like structured natural language), .ncd (the compiled formal plan), and .ncn (a plain-prose narrative auto-generated for pre-execution review). Because concept names are free-form strings, plans can be authored in any language, and one of the case studies is written entirely in Chinese.

NormCode scope rule and runtime isolation boundaries

Two levels of case-based reasoning

NormCode Canvas layers CBR on top of the language at two levels:

  1. Level 1: concrete cases. A Level 1 case is a suspended NormCode runtime, the full execution environment at a specific flow index, captured and persisted. Every completed node auto-writes a checkpoint to a per-project SQLite database.
  2. Level 2: abstract cases. Each compiled plan is itself a reusable case. Even more interesting, the compilation pipeline (Derivation to Formalization to Post-Formalization to Activation) is itself a NormCode plan, which the authors call the NC Compilations plan, so the system can compile itself.

Two concrete operations implement the CBR cycle inside a plan. Fork handles reuse: load a past case's Blackboard and Concept Repository into a new run, mark upstream nodes complete, and execute forward without re-running prior steps. Value Override handles revision: edit a tensor at any checkpoint, and the orchestrator marks only transitively downstream nodes as stale. Because the scope rule guarantees that only nodes downstream of f can depend on the tensor at f, the stale set is exactly determined by the data dependency graph. No manual dependency tracking.

Two-level CBR architecture with abstract and concrete case management

Four deployed plans as evidence

Rather than a benchmark, the paper offers four production workflows as structured evidence that the properties hold across control-flow patterns:

PlanWhat it doesNotable metric
PPT GenerationNested loop producing HTML and PPTX per slide from one componentized JSON~40s per slide on commercial APIs; ~4s content, 12-17s HTML render
Code AssistantReAct-style explore/plan/implement/verify loopUp to 10 reasoning cycles per task
NC CompilationsNatural language spec to executable NormCode planProduces executable plans in ~15 steps on qwen-plus/GLM-4.7
Canvas AssistantChat controller that, when wired to Cursor or Claude Code, automates plan debugging~20 inferences per session

A telling architectural detail: syntactic inferences perform deterministic data manipulation (routing, grouping, timing, looping) at zero LLM cost, and account for 60 to 70 percent of nodes in production plans. Only the semantic nodes actually hit an LLM, which is why per-slide generation stays cheap.

What is genuinely new here

The real contribution is not another agent framework. It is the argument that three practical capabilities fall out structurally from the language, not from tooling bolted on top:

  • C1 - Direct checkpoint inspection. The Detail Panel shows the exact bounded inputs to any step because the scope rule enforced them at runtime, not because a tracer reconstructed them from logs.
  • C2 - Pre-execution structural review. The .ncn narrative is a deterministic rendering of the actual formal plan. A domain expert can reject a plan before any LLM call, which the authors position as intervention at the plan-structure level rather than at the output level like RLHF or Constitutional AI.
  • C3 - Scope-bounded selective re-execution. Editing any tensor re-runs only what actually depends on it.

Where it does not work yet

The authors are unusually candid about limits. Case retrieval still requires operator judgment; learned similarity measures would help. The case base grows without bound, and competence-based pruning is future work. Semantic checkpoints are bounded-stochastic, meaning the same input yields the same output distribution rather than a fixed value. And NC Compilations only reliably produces plans for tasks with clear sequential structure. Plans with complex domain logic or rich environment interaction, such as PPT Generation's dual-format output loop, still require human or code-assistant authoring.

The paper also explicitly avoids claiming universal quality wins. The claims concern inspectability, revisability, and bounded re-execution in multi-step LLM workflows, not universal superiority of final-task quality. That is a refreshing scope for an agent framework paper.

Availability

The paper does not attach a public code repository, though it describes a deployed React 18 plus FastAPI application backed by per-project SQLite and Python WebSockets. The work was conducted at Psylens AI, and the underlying NormCode language specification is documented in a companion paper. Anyone building long-horizon agent workflows and wrestling with irreproducible checkpoints will find the scoped-intermediate-representation argument worth reading, even if they never touch the Canvas itself.