Build by composition

JavaScript programs, made of fragments.

FragmentCode turns a web program from one opaque block into an ordered recipe of discrete, addressable pieces. Build, revise, share, and load the exact behavior you need—then assemble it into a living program in the browser.

Program recipe resolved by server
01 State substrateowns data and boundaries Frag0!!3839
02 Pressure solversteps selectable physics Frag000!!155
03 Runtime loopcoordinates update phases exact revision
04 Interactive viewrenders and responds trusted origin
ordered fragments ↓ assembled at load time
Dynamic web program
state + behavior + interface

The basic unit

What is a fragment?

A fragment is an independently described unit of program behavior that FragmentCode can identify, version, load, replace, and reuse.

It is not limited to a function or a file. A fragment can own a data substrate, add a control, solve a physics step, render an interface, or coordinate an entire runtime phase. Its boundary is the behavior you want to understand and evolve as one piece.

01Intent and implementationHuman-readable purpose travels with executable JavaScript.
02Stable addressA server reference selects a specific stored fragment instead of a pasted copy.
03LineageBranches preserve how a fragment was refined, such as changing one game control without losing its origin.
04Composition contractModern fragments register a named API and summary so neighboring fragments can coordinate deliberately.
05Flexible scaleA fragment may be a small augmentation or a substantial subsystem; the useful behavior boundary matters more than line count.
Conceptual anatomyJavaScript
// The server resolves an exact stored revision.
const fragment = {
  id: "Frag000!!155",
  intent: "Selectable pressure physics",

  // A focused behavior with an explicit surface.
  api: {
    stepPressureField(options) { /* ... */ },
    readPressure(x, y) { /* ... */ }
  },

  summary: "Steps the pressure field while
  preserving contracts for downstream fragments."
};

AgentPruned.fragmentInterfaces.register(fragment);

The exact stored representation also carries descriptive and lineage data. Programs save an ordered list of fragment references, then resolve those references when they are assembled.

Observed in real programs

Fragments describe how a program grows.

Reviewing stored FragmentCode programs reveals units that span data, behavior, orchestration, presentation, and precise follow-up changes.

PeerWorldLive49 fragments

A system assembled by responsibility

Its recipe separates a typed-array lattice substrate, selectable pressure solver, slow deformable medium, control and resource systems, sandboxed example interfaces, analysis, rendering, and the runtime loop.

statephysicscontrollersruntimeUI
BoatGame16-fragment recipe

A game world built as cooperating behaviors

One ordered recipe grows from THREE.js setup into a voxel boat, animated water terrain, camera panning and zoom, fish-school encounters, embedded minigames, a staged sea-snake chase, and cannon feedback. Descendant fragments refine individual experiences—such as reshaping the hull or changing the snake's approach—while preserving the surrounding game.

WebGL sceneboat controlsencountersminigamesfocused revisions
Pongbranch lineage

A working program with focused variants

A base TV Pong fragment creates the paddles, ball, scoreboard, controls, and update loop. Descendant references preserve refinements such as replacing AI control with a second keyboard control scheme.

complete behaviorcontrol swaphistory
ExploringHumanoidincremental layers

Capabilities added around a live scene

Fragments wait for scene assets, add a THREE.js coordinate plane, introduce controls, and refine speed indicators. Each piece augments the existing browser world without requiring a single monolithic rewrite.

WebGLasset readinesscontrolsaugmentation
The unique pattern: a FragmentCode program records both the exact pieces in use and the path by which individual pieces changed. Composition and provenance are part of the program—not documentation added afterward.

Trusted loading

From stored references to a running program.

The server is more than a file host. It resolves identities and revisions, applies access rules, and delivers the ordered JavaScript that becomes the program.

Save the recipeThe program records an ordered set of fragment references rather than duplicating every source block.
Authorize the requestPublic, private, owner, and collaborator rules decide whether the exact program may be read.
Resolve and assembleThe trusted server retrieves each stored fragment revision and composes the program in order.
Run dynamicallyThe browser executes the assembled program, creating its state, DOM, graphics, events, and live behavior.
Trust matters

Fragments are executable JavaScript. Load them only from a server and operator you trust. A controlled HTTPS origin, exact revision references, authorization, and visible provenance create a clearer boundary than copying scripts from unknown pages or chaining arbitrary third-party CDNs.

Why build this way?

Change the piece, understand the consequence.

Reuse without copy-paste

Reference a trusted fragment in another program while keeping its identity and purpose visible.

Δ

Focused evolution

Create a descendant for one behavior change instead of forking an entire application.

Readable architecture

The recipe shows which responsibilities make up a program and the order in which they enter the runtime.

Exact revisions

Stable references make it possible to reload a known composition instead of depending on mutable pasted code.

Private collaboration

Server-side identity and permissions allow selected people to inspect, run, or edit private work without publishing it.

{ }

Browser-native output

Fragments remain JavaScript: they can create interfaces, simulations, games, tools, and responsive runtime behavior.

Dynamic by default

The result is not a static page.

Because fragments execute together in the browser, a loaded recipe can generate the page itself and continue changing it over time. Fragments can agree on shared interfaces, respond to users, update models, and render the next frame—turning a saved composition into a live web program.

Create and update DOM interfaces Draw with Canvas and WebGL Run animation and simulation loops Respond to keyboard, pointer, and touch Share state through declared APIs Swap a behavior while preserving the recipe

Start with one behavior

Build a program you can see, change, and compose.

Open FragmentCode to explore saved programs and their revisions, or sign in to begin building with fragments.