agentsclimarketplace

Causal dag layered layout from happens before

Skill kjuhwa/skills-hub/skills/frontend/causal-dag-layered-layout-from-happens-before

Self-correcting knowledge corpus for Claude Code — 9 stable shape clusters, bias-correction pipeline baked into contribution flow. 47 papers, 45 techniques, 1.1k skills.

Install
npx -y skills add kjuhwa/skills-hub --skill causal-dag-layered-layout-from-happens-before

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • 0 stars0 stars. Stars are a popularity signal and not a quality one, but at this level it is likely that nobody has read this closely except its author, and you would be relying on your own review.

What its author says it does

Copied from the file, not written here

Layout a DAG of events by longest happens-before depth per actor lane for readable causal diagrams.

SKILL.md

1.6 KB, as published. Nobody here has run it

causal-dag-layered-layout-from-happens-before

When visualizing event histories across multiple actors/replicas, naive timestamp-based X positioning produces crossing arrows and visual ambiguity because wall-clock time doesn't match logical causal order. The reusable trick is to assign each event an integer layer = 1 + max(layer(p) for p in parents) computed by a topological walk over the happens-before edges, then render the actor as the Y lane and layer as the X column. Concurrent events end up in the same column only when they're truly concurrent, and every causal arrow points strictly rightward.

function assignLayers(events, hb) { // hb: id -> parent ids
  const layer = new Map();
  const visit = id => {
    if (layer.has(id)) return layer.get(id);
    const parents = hb[id] ?? [];
    const l = parents.length ? 1 + Math.max(...parents.map(visit)) : 0;
    layer.set(id, l);
    return l;
  };
  events.forEach(e => visit(e.id));
  return layer; // x = layer*COL_W, y = actorIndex*ROW_H
}

This generalizes to any causal/provenance UI: git-like commit graphs, build pipelines, trace spans with explicit parent edges, CRDT operation logs. Pair it with a second pass that spreads equal-layer events vertically within an actor lane when the lane has multiple concurrent writes, and arrows never cross their own source column.

Keep looking

Skills are one crate of 328,083. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.